On Jun 29, 11:05 am, BarakatX2 <[email protected]> wrote:
> I have a form that allows a dynamic number of files to be uploaded. On
> the Django side, if I print the request.FILES it is described as:
>
> <MultiValueDict: {u'rqFiles': [<InMemoryUploadedFile: add.png (image/
> png)>, <InMemoryUploadedFile: del.png (image/png)>,
> <InMemoryUploadedFile: up.png (image/png)>]}>
>
> But when I try to access the files like this:
>
> for f in files['rqFiles']:
>
> Then f is a string with some ascii characters including the file
> extension. Shouldn't it be an InMemoryUploadedFile?
Yes. How are you checking that it is not? If you just print "f", you
will see the name of the file but its type would be correct.
> How should I be
> accessing files['rqFiles']?
Go through this doc:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handling-uploaded-files
On each of your files, you could use the f.chunks() method described
in the example in the above doc.
-RD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---