43👍
Just for future reference. I had the same error, though I included request.FILES
in form initialization. The problem was in the template: I forgot to add enctype="multipart/form-data"
attribute to the <form>
tag.
- Django test database is not created with utf8
- Passing a user, request to forms
- Where to instantiate boto s3 client so it is reused during a request?
0👍
If you have included request.FILES
and added the enctype="multipart/form-data"
, but are still seeing this error, it could be you are not declaring the <input>
correctly.
For example, if explicitly declare the input html in your template like:
<input type="file" value="Upload CSV File" />
You may not be passing the expected input id or name attributes of the input form element.
Be sure that your template is using the form element tag, i.e. {{ form.file }}
,
which django will then render as: <input id="id_file" name="file" type="file" required="">
on the page.
👤Rob
- Pycharm Can't retrieve image ID from build stream
- Django tests complain of missing tables
- Django pagination and "current page"
- Using APITestCase with django-rest-framework
- Django: Override Debug=True from manage.py runserver command
Source:stackexchange.com