|
|
|
@ -6,7 +6,7 @@ from flask import render_template
|
|
|
|
|
import glob
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
UPLOAD_FOLDER = './static/img/'
|
|
|
|
|
UPLOAD_FOLDER = ".\static\img\\"
|
|
|
|
|
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
|
|
|
|
|
def allowed_file(filename):
|
|
|
|
|
return '.' in filename and \
|
|
|
|
@ -36,14 +36,18 @@ from flask import request
|
|
|
|
|
def upload_file():
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
file = request.files['tile']
|
|
|
|
|
# print(request.files["zine test.png"])
|
|
|
|
|
if file and allowed_file(file.filename):
|
|
|
|
|
filename = file.filename
|
|
|
|
|
print("zine test.png",filename)
|
|
|
|
|
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
|
|
|
|
|
overwrite = request.form["overwrite"]
|
|
|
|
|
os.system(f"cp ./static/img/{ filename } ./static/img/{ overwrite }")
|
|
|
|
|
os.system(f"rm ./static/img/{ filename }")
|
|
|
|
|
|
|
|
|
|
if file and allowed_file(file.filename):
|
|
|
|
|
filename, fileextension = os.path.splitext(file.filename)
|
|
|
|
|
file.save(os.path.join(app.config['UPLOAD_FOLDER'], (overwrite + fileextension) ))
|
|
|
|
|
|
|
|
|
|
# print("==============================================================")
|
|
|
|
|
# print(fileextension)
|
|
|
|
|
# print(f"copy { UPLOAD_FOLDER + file.filename} { UPLOAD_FOLDER + overwrite + fileextension }")
|
|
|
|
|
# os.system(f"copy { UPLOAD_FOLDER + file.filename} { UPLOAD_FOLDER + overwrite + fileextension }")
|
|
|
|
|
# print(f"del { UPLOAD_FOLDER + file.filename }")
|
|
|
|
|
# os.system(f"del { UPLOAD_FOLDER + file.filename }")
|
|
|
|
|
|
|
|
|
|
return redirect("/")
|
|
|
|
|
# f = request.files['the_file']
|
|
|
|
|