best way to determine (MIME) content type of a stream of bytes?

[email protected] ("Robert P. J. Day")
Newsgroups php.general
Message-ID <alpine.LFD.2.00.1003081053100.7587@localhost>
  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
========================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.