19👍
✅
You will have to provide the enctype attribute to the FORM element (I’ve been bitten by this before). For example, your FORM tag should look like:
<form action="/submitpicture/" method="POST" enctype="multipart/form-data" >
Without the enctype, you will find yourself with an empty request.FILES.
👤ayaz
5👍
Instead of doing this manually I would take a look at the storage backend David Larlet has written for Django, django-storages
- Django: Accessing Many to Many object through another Many to Many relationship
- Django: set cookie on test client?
2👍
Adding enctype=”multipart/form-data” seems like something that’s worth mentioning in the “File Uploads” section of the django docs (http://docs.djangoproject.com/en/dev/topics/http/file-uploads/). Thoughts?
👤seth
Source:stackexchange.com