note 83739 deleted from ref.fileinfo by mazzanet

From: Date: Tue, 26 Apr 2011 09:45:26 +0000
Subject: note 83739 deleted from ref.fileinfo by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179145@lists.php.net to get a copy of this message
Note Submitter: john2496 at gmail dot com ---- As of now, mime_content_type, has been depreciated. This version of mime_content_type works well as a replacement and uses a method of mime detection previous posted. Other methods can be added in case the default method does not suffice. if (!function_exists('mime_content_type')) { function mime_content_type($file, $method = 0) { if ($method == 0) { ob_start(); system('/usr/bin/file -i -b ' . realpath($file)); $type = ob_get_clean(); $parts = explode(';', $type); return trim($parts[0]); } else if ($method == 1) { // another method here } } } // image/png echo mime_content_type('somepng.png');

« previous php.notes (#179145) next »