What you're really looking for the is the 'magic' of the bin file.

http://en.wikipedia.org/wiki/Magic_number_%28programming%29

There is a PECL extension for diving into libmagic ...

http://pecl.php.net/package/Fileinfo

- Jon

On May 10, 2007, at 8:35 PM, David Krings wrote:

Hi!

When one gets a file via upload information about the file is in $_FILE and with that also the MIME type (although one cannot rely on that).

Is there anything like this that works on local files as well? In particular, I want to figure out if a file is really an image file and not just some junk file that happens to have a .jpg, .tif, etc file extension. I thought about going by the exif header, but some image files don't have that, but are still valid, web supported image files.

Am I pushing my luck here?

David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to