简体   繁体   English

Python Flask-Uploads 获取上传状态/进度条

[英]Python Flask-Uploads Get Upload status/progress bar

I am trying to create a form and upload a file using Flask.我正在尝试使用 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.我计划更改代码以使用 Flask-Uploads,但文档没有提及任何关于我可以用来更新进度条的上传状态。

The entire app is made in Dash.整个应用程序是用 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?是否可以仅使用 flask 获取文件上传状态? I cannot use JQuery solutions at the moment.我目前无法使用 JQuery 解决方案。

You can call the upload method using fetch and display a "please wait" message until the operation is done.您可以使用fetch调用上传方法并显示“请稍候”消息,直到操作完成。 You dont have to use JQuery.您不必使用 JQuery。

Or或者

You can look here for a real progress bar solution.你可以在这里寻找一个真正的进度条解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM