When I do:

print type(f)

It outputs:

<type 'str'>

Also when I try to get the filename using the name property of
UploadedFile, it says:

'str' object has no attribute 'name'

When I just print f it shows:

ëPNG

On Jun 29, 10:48 am, Rajesh D <rajesh.dha...@gmail.com> wrote:
> On Jun 29, 11:05 am, BarakatX2 <baraka...@gmail.com> 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/#handli...
>
> 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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to