Saturday, December 25, 2010

How to verify the content-type & charset of uploaded file?

In the doc (http://docs.djangoproject.com/en/1.2/topics/http/file-
uploads/#uploadedfile-objects
) it is stated that:

"UploadedFile.content_type
The content-type header uploaded with the file (e.g. text/plain or
application/pdf). Like any data supplied by the user, you shouldn't
trust that the uploaded file is actually this type. You'll still need
to validate that the file contains the content that the content-type
header claims -- "trust but verify."

"UploadedFile.charset
For text/* content-types, the character set (i.e. utf8) supplied by
the browser. Again, "trust but verify" is the best policy here."

So how do I verify the content-type & charset of uploaded file?

Thanks.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate