On Thu, Apr 9, 2009 at 11:15 AM, higer <higerinbeij...@gmail.com> wrote:
>
> When I upload a PNG file and use PIL to handle it,there will be an
> error occured:
> 'NoneType' object is unsubscriptable
>
> I do not know why and other formats(BMP GIF JPG JPEG) are all ok.
> The following is  my code in my views.py:
>
> f = request.FILES["imagefile"]
> fileExt = (f.name).split(".")[-1].lower() #get the pic's extension
> parser = ImageFile.Parser()
> for chunk in f.chunks():
>       parser.feed(chunk)
> img = parser.close()
> img.save("test"+"."+fileExt)
>
I guess you can save the file uploaded directly, any special reason to use PIL ?

Kushal
-- 
http://fedoraproject.org
http://kushaldas.in

--~--~---------~--~----~------------~-------~--~----~
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