note 54387 deleted from ref.mime-magic by nlopess
| From: | nlopess@php.net | Date: | Mon, 13 Mar 2006 18:41:13 +0000 |
| Subject: | note 54387 deleted from ref.mime-magic by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105733@lists.php.net to get a copy of this message | ||
Note Submitter: hans at lintoo dot dk
----
When using fileinfo, I had a *lot* of problems with the mime file.
Using Apache2, FreeBSD and PHP5, I had no mime file is supply the fileinfo. So I had to use a custom
mime file from a previous distribution of Apache, the files can be downloaded from here:
http://www.lintoo.dk/public/magic
and
http://www.lintoo.dk/public/magic.mime
It seems that both files are needed, although only one is supplied for fileinfo.
I used it for my file object:
<?php
$info = new finfo(FILEINFO_MIME,"./magic");
$this->fileType = $info->file($openpath);
?>
Should be rather self-explanatory, just remember to provide the path to the magic file as the second
parametre when creating the fileinfo object.
I hope the originial creators of the magic files do not mind i uploaded them to http://lintoo.dk/ and share them with you. I mean no disrepect, but I
cannot remember where I got the files.