检测文件下载完成状态 [英] Detecting File Download Completion Status
问题描述
我想询问是否可以检查Django中的文件(csv文件)下载的状态。
我有一个带有按钮的模板页面,当单击时,打开一个另存为对话框,用于从服务器下载文件(文件内容从数据库检索)。下载完成后,我想更新我的数据库与其状态(如果下载完成状态=下载,如果中止状态=中止,如果取消状态=取消,我该怎么办?
I would just like to ask if it's possible for me to check the status of a file (csv file) download in Django . I have a template page with a button, which when clicked, opens a 'Save As' dialog box for downloading a file from the server (file content is retrieved from db). after the download is complete i want to update my DB with its status (if download complete status = Downloaded ,if abort status = aborted , if Cancel Status= Canceled . How can i do this ?
推荐答案
我不知道这是否是你想要的,但是您可以在两个时间点检查文件大小,然后比较文件大小,确定下载是否暂停有些原因,这个解决方案不是很好。
I don't know if this is exactly what you want, but you could check filesize at two timepoints and then compare the filesize. For sure if the download is pausing for some reason, this solution is not very good.
这篇关于检测文件下载完成状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!