You could look at file signatures:

https://en.wikipedia.org/wiki/List_of_file_signatures

Of course that doesn't guaruntee that the file is valid/conforms to the format.

On 10/31/2013 02:32 PM, Claudio Dusan Vega Ozuljevich wrote:
Hi guys!

Sorry for the noob question, but I just learned programming and I'm
still struggling to get the hang of it.

I need to know if there is a way to check the file type (pdf, doc,
jpeg etc) of an uploaded file, so I can store it just if it complies
with my requirements. Fo example, I want to check if a file is an
image (jpeg), an in case it is store it and in case it isn't just show
an error message.

I'm not referring the issue as "the extension" of the file, because
the extension can be change and file would still be a .exe but just
with the ".jpeg" extension.

Thanks beforehand.


--
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to