Django newforms file upload
by
Dan Fairs
—
last modified
Oct 28, 2007 05:57 PM
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.
