Oct 28

Django newforms file upload

Existing documentation about updating request.POST with request.FILES is now obsolete.

There are several places documenting that to get newforms working with file uploads, you have to do something like this (where NewformsClass is, you guessed it, a newforms class):

 new_data = request.POST.copy()  
 new_data.update(request.FILES) 
 form = NewformsClass(new_data)

This is now out-of-date, and has been simplified to the following:

form = NewformsClass(request.POST, request.FILES)

Much neater.

I've disabled comments for now due to spam problems - I'll turn them back on when I've fixed it!

This won't be published anywhere, it's just in case I need to contact you.

You can use Markdown in your comments. Be sensible!

Sorry about this, but I don't want spam comments.