Re: FW: [PHP-DB] mime-type related to extension?. .

From: Date: Wed, 27 Apr 2005 13:19:15 +0000
Subject: Re: FW: [PHP-DB] mime-type related to extension?. .
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-39291@lists.php.net to get a copy of this message
meal list_php wrote:
Hi I sent this on 21st of april and got no answer... there is no way to check the "real" mime type of a file? even a file without extension? thanks,
You can call out to an external program called "file" (which is pretty much guaranteed to be there, on a Linux system) which uses some magic to determine the file type. It should be able to tell you if the file is jpeg regardless, without any messy work from you. It will return a string like so: $ file false.doc false.doc: JPEG image data, JFIF standard 1.02 I'd run a few tests with some images from different sources, but it should be returning a very standard string - "JPEG image data" should at least be common. IIRC Sony also has a 'motion jpeg' which might cause you problems, depending on what you're doing - if you can get a hold of one of those to test (if it's a concern) you might want to. cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.

« previous php.db (#39291) next »