diff --git a/week5/__pycache__/app.cpython-310.pyc b/week5/__pycache__/app.cpython-310.pyc index 3665684..cbe518d 100644 Binary files a/week5/__pycache__/app.cpython-310.pyc and b/week5/__pycache__/app.cpython-310.pyc differ diff --git a/week5/app.py b/week5/app.py index d73a600..aac2c67 100644 --- a/week5/app.py +++ b/week5/app.py @@ -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'] diff --git a/week5/static/img/20230601-opus reticulatum.png b/week5/static/img/20230601-opus reticulatum.png deleted file mode 100644 index a37065c..0000000 Binary files a/week5/static/img/20230601-opus reticulatum.png and /dev/null differ diff --git a/week5/static/img/34.png b/week5/static/img/34.png index be58763..21d881e 100644 Binary files a/week5/static/img/34.png and b/week5/static/img/34.png differ diff --git a/week5/static/img/87 b/week5/static/img/87 deleted file mode 100644 index fe7cd84..0000000 Binary files a/week5/static/img/87 and /dev/null differ diff --git a/week5/static/img/95.png b/week5/static/img/95.png index b442822..d4682ff 100644 Binary files a/week5/static/img/95.png and b/week5/static/img/95.png differ diff --git a/week5/static/img/96.png b/week5/static/img/96.png index 88d9d1c..639dd61 100644 Binary files a/week5/static/img/96.png and b/week5/static/img/96.png differ diff --git a/week5/static/img/98.png b/week5/static/img/98.png index 591c0c8..1d2b982 100644 Binary files a/week5/static/img/98.png and b/week5/static/img/98.png differ diff --git a/week5/static/img/WhatsApp Image 2023-04-18 at 17.55.06 (1).jpeg b/week5/static/img/WhatsApp Image 2023-04-18 at 17.55.06 (1).jpeg deleted file mode 100644 index b755be8..0000000 Binary files a/week5/static/img/WhatsApp Image 2023-04-18 at 17.55.06 (1).jpeg and /dev/null differ diff --git a/week5/templates/mosaic.html b/week5/templates/mosaic.html index db6eb4c..c1e74c5 100644 --- a/week5/templates/mosaic.html +++ b/week5/templates/mosaic.html @@ -18,7 +18,7 @@
{% for image in images %}{% endfor %} -