note 90797 deleted from function.finfo-open by danbrown

From: Date: Sun, 10 May 2009 21:40:08 +0000
Subject: note 90797 deleted from function.finfo-open by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154422@lists.php.net to get a copy of this message
Note Submitter: rond dot nunes at gmail dot com ---- I've modified the function created by <ian@createanet.co.uk>. His function check the mime even if the file doesn't exist. I just added a file_exists verification. If file exists, it returns the mime type, else, returns false; <?php function get_mime_type($filepath) { if(file_exists($filepath)){ ob_start(); system("file -i -b {$filepath}"); $output = ob_get_clean(); $output = explode("; ",$output); if ( is_array($output) ) { $output = $output[0]; } return $output; } else{ return false; }} ?>

« previous php.notes (#154422) next »