javapyscript
javapyscript

Reputation: 737

Python Flask-Uploads Get Upload status/progress bar

I am trying to create a form and upload a file using Flask. The current code that I have saves the file successfully to my local server, but I do not have a way to find the upload status, if I upload a large file. I am planning to change the code to use Flask-Uploads, but the documentation does not mention anything about upload status which I could use to update my progress bar.

The entire app is made in Dash. The current code is as follows:

UPLOAD_FOLDER = os.get_cwd()
if request.method == 'POST':
    file = request.files['file']
    filename = file.filename
    file.save(os.path.join(UPLOAD_FOLDER, filename))

Is it at all possible to get file upload status using flask only? I cannot use JQuery solutions at the moment.

Upvotes: 0

Views: 9613

Answers (1)

balderman
balderman

Reputation: 23825

You can call the upload method using fetch and display a "please wait" message until the operation is done. You dont have to use JQuery.

Or

You can look here for a real progress bar solution.

Upvotes: 0

Related Questions