I have a model EventType that has an ImageField named image.

When I post my image upload form I can upload an image with no problems.


But when I try to save() an image from the file system I get the error:

'str' object has no attribute 'chunks'


Here is my code:

et = EventType( name=name )
et.save()

image_name = "%s.png" % name
image_path = "%s/images/%s.png" % ( settings.MEDIA_ROOT, name )
image_file = open( image_path, 'rb' )

et.image.save( image_name, image_file.read() )


I'm sure the file exists and is readable.

I'm not sure why image_file.read() is returning a str, it spews a
bunch of what appears to be image data when I debug it.

Any idea what I'm doing wrong?


Thanks.


-- 
Greg Donald
destiney.com | gregdonald.com

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