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

From: Date: Mon, 08 Mar 2010 15:57:14 +0000
Subject: best way to determine (MIME) content type of a stream of bytes?
Groups: php.general 
Request: Send a blank email to php-general+get-302601@lists.php.net to get a copy of this message
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 ========================================================================

« previous php.general (#302601) next »