From: "Robert P. J. Day" on

hi, i'm interested in the most comprehensive way to determine the
content type of a stream of bytes that's been uploaded to a PHP
script? assuming that the bytes are uploaded simply via a POST
parameter, i can see that there are a couple ways to do it:

* getimagesize()
* FileInfo

i've been doing some testing this morning and a few video formats
handed to FileInfo come back as "application/octet-stream" which isn't
particularly informative. and i want to support as many different
formats of image, audio and video as possible.

so ... what's the best way? oh, by the way, when i used fileinfo, i
didn't bother handing over a magic file. i'm starting to think that
would make a difference. and is there a noticeable advantage to
upgrading to PHP 5.3 since the server (centos 5.4) is currently
running only PHP 5.1.6. thanks.

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================