Flask-WTF FileField does not set data attribute to an instance of Werkzeug FileStorage
I looked into the source code (form.py
) and figured out the issue: the code to replace the default data attribute with the FileStorage
object is not activated if the form is initialized with a specific formdata
. The formdata
must be left unspecified in order for the file functionality to work. Replacing this line:
form = SettingsForm(request.form)
With this line:
form = SettingsForm()
Resolved the issue.