note 85348 added to ref.fileinfo

From: Date: Wed, 27 Aug 2008 00:03:13 +0000
Subject: note 85348 added to ref.fileinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-143852@lists.php.net to get a copy of this message
In response to the suggestion from "jon at cybus" below to symlink /usr/share/file/magic to /etc/magic.mime, note that this causes other problems (in Debian Etch, anyway). It breaks the -i functionality of the file command, causing it to return the human-readable string instead of the MIME type. It also results in finfo doing the same. So, it is probably better to actually specify the path to the magic file correctly when instantiating your finfo object: <?php $fi = new finfo(FILEINFO_MIME,'/usr/share/file/magic'); $mime_type = $fi->buffer(file_get_contents($file)); ?> Of course, you still end up with something that cannot tell the difference between a Word document and an Excel spreadsheet. ---- Server IP: 64.71.164.2 Probable Submitter: 130.13.133.201 ---- Manual Page -- http://www.php.net/manual/en/ref.fileinfo.php Edit -- https://master.php.net/note/edit/85348 Del: integrated -- https://master.php.net/note/delete/85348/integrated Del: useless -- https://master.php.net/note/delete/85348/useless Del: bad code -- https://master.php.net/note/delete/85348/bad+code Del: spam -- https://master.php.net/note/delete/85348/spam Del: non-english -- https://master.php.net/note/delete/85348/non-english Del: in docs -- https://master.php.net/note/delete/85348/in+docs Del: other reasons-- https://master.php.net/note/delete/85348 Reject -- https://master.php.net/note/reject/85348 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143852) next »