note 54387 added to ref.mime-magic
| From: | hans at lintoo dot dk | Date: | Sat, 02 Jul 2005 13:22:04 +0000 |
| Subject: | note 54387 added to ref.mime-magic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91310@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/ref.mime-magic.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54387
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54387&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54387&report=yes
Search -- http://master.php.net/manage/user-notes.php