Created
December 1, 2021 14:21
-
-
Save yarickprih/3ff259cd38eea2a4b0e462b76a74213d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/upload", methods=["GET", "POST"]) | |
def upload_file(): | |
form = FileUploadForm() | |
if form.validate_on_submit(): | |
file = form.document.data | |
file_name = secure_filename(file.filename) | |
save_path = get_user_uploads_folder(current_user) / file_name | |
file.save(save_path) | |
flash("File uploaded successfully", category="success") | |
return redirect(url_for("list_user_files")) | |
flash_form_errors(form) | |
return render_template("upload_file.html", form=form) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment