Re: fileinfo returning wrong mime type for Excel files
| From: | b | Date: | Thu, 30 Jul 2009 13:22:24 +0000 |
| Subject: | Re: fileinfo returning wrong mime type for Excel files | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296057@lists.php.net to get a copy of this message | ||
On 07/30/2009 08:53 AM, Peter Ford wrote:
Have you tried using 'file -i' from the command line: after all you are looking for a MIME type with your fileinfo... Having said that, with file -i on my system, Word documents are 'application/msword' and Excel files are 'application/octet-stream'Fedora11 (2.6.29.6-213.fc11.i586) $ file excel.xls excel.xls: CDF V2 Document, Little Endian, Os: Windows, Version 5.1, Code page: 1252, Author: ??????????????????????????, Last Saved By: ELAN, Name of Creating Application: Microsoft Excel, Last Printed: Sun Nov 6 18:04:20 2005, Create Time/Date: Tue Nov 1 02:56:47 2005, Security: 0 $ file -i excel.xls excel.xls: application/vnd.ms-excel; charset=binary Using 5.2.9, the OP's script prints: application/vnd.ms-excel; charset=binary I wonder if the problem lies with the documents themselves. Last May, I posted a msg here about how FileInfo was reporting back "application/msword application/msword" for some (but not all) Word docs. I never received a reply about it but came up with a hack to split on the space, if present.