|
|
|
@ -2,6 +2,7 @@ from os import path
|
|
|
|
|
from flask import render_template, Blueprint, request, session, flash
|
|
|
|
|
from flask import send_from_directory, redirect, url_for, current_app
|
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
|
from secrets import token_urlsafe
|
|
|
|
|
from suchwow import wownero
|
|
|
|
|
from suchwow.models import Post, Comment
|
|
|
|
|
from suchwow.utils.decorators import login_required, profile_required
|
|
|
|
@ -67,7 +68,10 @@ def create():
|
|
|
|
|
flash("You didn't give your meme a spicy title, bro! You're fuckin up!")
|
|
|
|
|
return redirect(request.url)
|
|
|
|
|
if file and allowed_file(file.filename):
|
|
|
|
|
filename = secure_filename(file.filename)
|
|
|
|
|
filename = "{}-{}".format(
|
|
|
|
|
token_urlsafe(12),
|
|
|
|
|
secure_filename(file.filename)
|
|
|
|
|
)
|
|
|
|
|
save_path_base = path.join(current_app.config["DATA_FOLDER"], "uploads")
|
|
|
|
|
save_path = path.join(save_path_base, filename)
|
|
|
|
|
file.save(save_path)
|
|
|
|
|