From 264d571c3eb31fbeb8f7475e69e04cac345ffd60 Mon Sep 17 00:00:00 2001 From: vitrinekast Date: Wed, 26 Jun 2024 18:40:16 +0200 Subject: [PATCH] show the path --- app.py | 9 +++++---- templates/index.html | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index e659bd7..f7ea177 100644 --- a/app.py +++ b/app.py @@ -22,7 +22,7 @@ def index(): @app.route("/submitted") def submitted(): print("doingsubmit") - return render_template('index.html', error=request.args.get('error'), submitted=True) + return render_template('index.html', error=request.args.get('error'), submitted=True, saved_path=request.args.get('path')) def get_random_subfolder(): # folder = os.listdir(app.config['UPLOAD_FOLDER']) @@ -63,7 +63,7 @@ def upload_file(): img.thumbnail((100, 100), Image.LANCZOS) img.save(os.path.join(sub_folder, filename)) - return redirect(url_for('submitted')) + return redirect(url_for('submitted', path=os.path.join(sub_folder, filename))) elif ext in ['mp4', 'avi', 'mov', 'flv']: file.save(temp_path) @@ -81,7 +81,7 @@ def upload_file(): ffmpeg.execute() os.remove(temp_path) - return redirect(url_for('submitted')) + return redirect(url_for('submitted', path=out_path)) elif ext in ['mp3', 'wav', 'flac']: out_path = os.path.join(sub_folder, filename.rsplit('.', 1)[0].lower() + '.mp3') file.save(temp_path) @@ -98,7 +98,8 @@ def upload_file(): ffmpeg.execute() os.remove(temp_path) - return redirect(url_for('submitted')) + return redirect(url_for('submitted', path=out_path)) + else: print("not an image!") return redirect(url_for('submitted', Error="The file you are trying to upload is not supported by our infra-ordinary")) diff --git a/templates/index.html b/templates/index.html index bf0ba5c..fb925d2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,7 +9,7 @@