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 ?
Such as a particular byte sequence at a particular location in the file?


John Joyce