show the path

main
vitrinekast 6 months ago
parent 6332dd11c1
commit 264d571c3e

@ -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"))

@ -9,7 +9,7 @@
<style>
@font-face {
font-family: Montserrat;
src: url(Montserrat-VariableFont_wght.ttf);
src: url(templates/Montserrat-VariableFont_wght.ttf);
}
html,
body {
@ -200,7 +200,7 @@
</div>
<h2>Upload your Infraordinary Observations:</h2>
<p>Inform our mapping by sharing your experiences with the infraordinary. It can be an image, video or audio file, upload your media here!</p>
<p>{{saved_path}}</p>
{% if error %}
<h1 class="error">Oops.. Something went wrong: {{ error }}!</h1>
{% endif %}

Loading…
Cancel
Save