note 84842 modified in function.finfo-file by danbrown
| From: | danbrown@php.net | Date: | Fri, 01 Aug 2008 16:45:01 +0000 |
| Subject: | note 84842 modified in function.finfo-file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143023@lists.php.net to get a copy of this message | ||
OO (bit improved) version of the same thing
<?php
$file = '<somefile>';
$ftype = 'application/octet-stream';
$finfo = @new finfo(FILEINFO_MIME);
$fres = @$finfo->file($file);
if (is_string($fres) && !empty($fres)) {
$ftype = $fres;
}
?>
--was--
OO (bit improved) version of the same thing
$file = '<somefile>';
$ftype = 'application/octet-stream';
$finfo = @new finfo(FILEINFO_MIME);
$fres = @$finfo->file($file);
if (is_string($fres) && !empty($fres)) {
$ftype = $fres;
}
http://php.net/manual/en/function.finfo-file.php