On Feb 4, 7:44 pm, Brian Morton <rokclim...@gmail.com> wrote:
> However, I am not sure how to get access to the
> content type reported by the browser for the uploaded file in the
> model save method.  Can you access the request from a model save in
> the admin?

You can get the content type from UploadedFile object[1]. I haven't
used the SimpleUploadedFile, but I am assuming it is a subclass of
UploadedFile. I do this in my form processing (the clean_* methods) on
my forms that take uploaded file. I don't think this is available on
the model save though. On model save, I would suggest just opening the
image in PIL and checking im.format.

-John

[1] 
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=olddocs#uploadedfile-objects


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