This commit is contained in:
fingadumbledore 2023-01-27 19:39:45 +01:00
parent 03fbea787e
commit 46baf08d2a
2 changed files with 13 additions and 2 deletions

View File

@ -642,12 +642,19 @@ def server():
con.close()
@app.route("/upload_file", methods=['POST'])
@app.route("/upload_file", methods=["POST"])
def upload_file():
"""
log_server("called /upload_file")
file = request.files
print(f"{file=}")
return render_template(f'404.html')
return render_template(f'404.html')"""
file = request.files["file"]
if file:
file.save("/Export", file.filename)
return "File uploaded successfully!"
return "No file found"
@app.errorhandler(404)
def page_not_found(e):

View File

@ -349,6 +349,10 @@
<button onclick="save()">&#x1F4BE;</button>
</div>
<div hidden class="tmplt_tab" id="_files">
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
<form class="modal-content animate" action="/upload_file" method="POST">
<div class="container" style="margin-top: 2em">
<label for="form_file">