Re: fileinfo returning wrong mime type for Excel files

From: Date: Thu, 30 Jul 2009 12:53:05 +0000
Subject: Re: fileinfo returning wrong mime type for Excel files
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-296056@lists.php.net to get a copy of this message
Christoph Boget wrote: >>> /usr/share/file/magic >> /usr/share/file/magic has lots of rules to know its type and its just >> matching it. > > I know it has a lot of rules. Grepping it for excel shows that there > are rules in it for those types of files as well. > >> Maybe your file is quite strange . have you tried with other xls files? > > Yes, I have; the result is the same for all. > >> what does "file /path/to/my/excel.xls" say > > $ file excel.xls > excel.xls: Microsoft Office Document > > Interestingly... > > $ file word.doc > word.doc: Microsoft Office Document > > So apparently, to the file command, there is no distinction. That > seems both odd and wrong to me. But not nearly as wrong as fileinfo > reporting "application/msword" as the mime type of an excel document. > > thnx, > Christoph 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' -- Peter Ford phone: 01580 893333 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent

« previous php.general (#296056) next »