El Jul 18, 2007, a las 4:25 PM, John Joyce escribióº

> I know how to validate a file based only on the file name dot  
> extension, but this seems wholly insecure to me.
> I feel that just testing for .jpg, .png, .jpeg, .gif, etc... is not  
> enough.
> Clearly renaming a file to anything at all is easy to do.
> How can I read into the file and check to see if it is is actually  
> a file of a given image type? Is there file header info to look for ?

The canonical solution is to delegate to this library:

   http://grub.ath.cx/filemagic/

-- fxn