[nycphp-talk] Checking 'mime type' of local file
csnyder
chsnyder at gmail.com
Fri May 11 11:39:33 EDT 2007
On 5/10/07, Jon Baer <jonbaer at jonbaer.com> wrote:
> 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
>
In the past, I've made use of the unix file command for this.
csnyder$ file -bi Desktop/DSC01060.jpg
image/jpeg
Command above uses -b for brief, and -i to get the mimetype of the file.
--
Chris Snyder
http://chxo.com/
More information about the talk
mailing list