[Fixed]-How to upload a file with django (python) and s3?

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

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

Leave a comment