Browse Source
fix: save before loading list
Also drop print. This updates the uploaded list correctly.
main
decentral1se
2 weeks ago
No known key found for this signature in database
GPG Key ID: 3789458B3D0C410
1 changed files with
6 additions and
4 deletions
-
upload.py
|
|
@ -39,6 +39,11 @@ def saveimage(image): |
|
|
|
def index(): |
|
|
|
"""Upload route, a page to upload an image""" |
|
|
|
imageuploadform = ImageUploadForm() |
|
|
|
|
|
|
|
if request.method == "POST": |
|
|
|
if imageuploadform.validate_on_submit(): |
|
|
|
saveimage(imageuploadform.image.data) |
|
|
|
|
|
|
|
uploaded_files = sorted( |
|
|
|
[ |
|
|
|
os.path.join(APP.config["IMAGE_FOLDER"], file) |
|
|
@ -46,10 +51,7 @@ def index(): |
|
|
|
], |
|
|
|
key=os.path.getctime, |
|
|
|
) |
|
|
|
print(uploaded_files) |
|
|
|
if request.method == "POST": |
|
|
|
if imageuploadform.validate_on_submit(): |
|
|
|
saveimage(imageuploadform.image.data) |
|
|
|
|
|
|
|
return render_template( |
|
|
|
"upload.html", |
|
|
|
imageuploadform=imageuploadform, |
|
|
|