我正在使用使用Python的Flask(基于Werkzeug).
用户可以下载文件,我正在使用send_from_directory-function.
send_from_directory
但是,实际下载文件时,content-length不会设置HTTP标头.因此用户不知道要下载的文件有多大.
content-length
我可以os.path.getsize(FILE_LOCATION)在Python 中使用来获取文件大小(以字节为单位),但无法找到content-length在Flask中设置标头的方法.
os.path.getsize(FILE_LOCATION)
有任何想法吗?
python download werkzeug http-headers flask
download ×1
flask ×1
http-headers ×1
python ×1
werkzeug ×1