Flask: Get the size of request.files object

后端 未结 5 1299
旧巷少年郎
旧巷少年郎 2020-12-03 01:15

I want to get the size of uploading image to control if it is greater than max file upload limit. I tried this one:

@app.route(\"/new/photo\",methods=[\"POST         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 01:42

    The following section of the code should meet your purpose..

    
    form_photo.seek(0,2)
    size = form_photo.tell()
    
    

提交回复
热议问题