note 83739 added to ref.fileinfo

From: Date: Tue, 10 Jun 2008 00:00:04 +0000
Subject: note 83739 added to ref.fileinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-140290@lists.php.net to get a copy of this message
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'); ---- Server IP: 64.71.164.2 Probable Submitter: 68.194.255.161 ---- Manual Page -- http://www.php.net/manual/en/ref.fileinfo.php Edit -- https://master.php.net/note/edit/83739 Del: integrated -- https://master.php.net/note/delete/83739/integrated Del: useless -- https://master.php.net/note/delete/83739/useless Del: bad code -- https://master.php.net/note/delete/83739/bad+code Del: spam -- https://master.php.net/note/delete/83739/spam Del: non-english -- https://master.php.net/note/delete/83739/non-english Del: in docs -- https://master.php.net/note/delete/83739/in+docs Del: other reasons-- https://master.php.net/note/delete/83739 Reject -- https://master.php.net/note/reject/83739 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140290) next »