note 62843 deleted from ref.mime-magic by nlopess
| From: | nlopess@php.net | Date: | Fri, 10 Mar 2006 18:24:12 +0000 |
| Subject: | note 62843 deleted from ref.mime-magic by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105232@lists.php.net to get a copy of this message | ||
Note Submitter: Daniel
----
this is the example from the pecl module. I found I had to add the full path to the magic file to
get it to work.
<?php
if(!extension_loaded('fileinfo')) {
die("fileinfo extension is not avaliable, please compile it.\n");
}
$path = "/path/to/file";
$res = finfo_open(FILEINFO_MIME,"/usr/share/misc/magic");
$mime_type = finfo_file($res,$path);
echo "mime_type is $mime_type";
?>