File is empty after saving flask uploads

前端 未结 2 876
花落未央
花落未央 2021-01-24 12:33

I\'ve been trying to upload a file using Flask and HTML forms. Now I can save an uploaded file but it shows up empty (0 bytes). After that I store the form entries in a database

2条回答
  •  囚心锁ツ
    2021-01-24 13:24

    We don't really know what the class photos is, nor what it's method save does, but that's where the error is probably occurring.

    Try this instead:

    request.files['photo'].save('test.jpg')
    

提交回复
热议问题