[UPHPU] mime_content_type question

Kenneth Burgener kenneth at mail1.ttak.org
Fri Oct 27 16:01:38 MDT 2006


Daniel wrote:
> I use mime_content_type to get mime types of files.  When I use this
> function on a .mp3 file it says "text/plain."  If I use the file command on
> a Linux box it says "audio/mpeg."  How can I get mime_content_type to say
> "audio/mpeg" when I pass it a .mp3 file?


If it works with the file command you could always use the suggestion
from the mime-content-type document page: [1]

function get_mime_content_type ( $f )
{
  return exec ( trim( 'file -bi ' . escapeshellarg ( $f ) ) ) ;
}


I guess the first question is, are you using PHP4 or PHP5, and is the
php code running on Windows or Linux?  I know you ran 'file' on a Linux
machine, but you seem to imply that the php code is not running on that
machine?



[1] http://us2.php.net/manual/en/function.mime-content-type.php


More information about the UPHPU mailing list