Hallöchen!

Torsten Bronger writes:

> I'd like to ensure that people only upload PDF files, so the file
> must start with "%PDF".  If the file starts with something else,
> the form must not validate.
>
> How do I do that?  I though about a clean_... method which reads
> the start of the file and then re-opens it.  Is this a good idea?

At least this works.  A look at the source code revealed that every
UploadedFile object must have an open() method, so re-opening it
should be safe, no matter which storage system or uploaded file type
is in use.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


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