I've been trying to understand how to handle file uploads, and I've got the 
upload portion down.  I have a FileField in my form, process it in my view, 
and it's saved in the correct location as specified in MEDIA_ROOT and the 
upload_to attribute of the Model.  My problem is, when I try to bind the 
uploaded document in a GET request, nothing is working.  I tried following 
the documentation in the docs 
<https://docs.djangoproject.com/en/1.6/ref/forms/api/#binding-uploaded-files>, 
but when I do that I get a 'FieldFile' does not have the buffer interface 
error.  How do I bind the file to the form so it's available to the user to 
download or open, while preserving the ability for the user to replace the 
uploaded file?  Do I have to extract the file from the model field before 
binding it to the form?  Code below.  Thanks in advance

    form_data = {
'sub_id':s.id,
...
'sub_verified_by':s.verified_by
}
form_file = {'sub_pdr': SimpleUploadedFile('SubmissionPDR.docx', 
s.pdr_file)}
form = SubmissionEditForm(form_data, form_file)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d8413ae-ca26-425a-841a-ebd8006553bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to