can we count the upload filesize before uploading in python-flask

前端 未结 2 920
滥情空心
滥情空心 2021-01-23 07:13

I have a simple flask app where i am uploading single file but with file size of less than 5MB
for that i have defined
if request.content_length < 5.250e+6: ##

2条回答
  •  佛祖请我去吃肉
    2021-01-23 07:52

    Flask is able to limit file size while upload is in progress, see the documentation. All you need is to set MAX_CONTENT_LENGTH when configuring your app.

提交回复
热议问题