Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-31 Thread Ashley Sheridan
On Thu, 2009-07-30 at 21:26 -0400, b wrote: On 07/30/2009 10:15 AM, Ashley Sheridan wrote: On Thu, 2009-07-30 at 07:12 -0700, Christoph Boget wrote: You could email it to me, which I presume is better if you replied back just to me and not the list? Just copying the list back on in

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
/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

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Peter Ford
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

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread b
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'

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
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' $ file -i excel.xls excel.xls:

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
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:

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Ashley Sheridan
On Thu, 2009-07-30 at 09:51 -0400, Christoph Boget wrote: 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:

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
The xls file I am using was generated with Excel (of Office 2007) for the Mac.  So either you have a different magic file (assuming that's what the file command uses) than I do or different versions of excel contain different information. I just tried using an excel spreadsheet saved using

RE: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Bob McConnell
From: Christoph Boget 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' $ file -i

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Ashley Sheridan
__ From: Ashley Sheridan a...@ashleysheridan.co.uk To: Christoph Boget jcbo...@yahoo.com Sent: Thursday, July 30, 2009 10:05:33 AM Subject: Re: [PHP] fileinfo returning wrong mime type for Excel files On Thu, 2009-07-30 at 07:04 -0700, Christoph Boget wrote: To test

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread b
On 07/30/2009 10:15 AM, Ashley Sheridan wrote: On Thu, 2009-07-30 at 07:12 -0700, Christoph Boget wrote: You could email it to me, which I presume is better if you replied back just to me and not the list? Just copying the list back on in this one now. I don't know of any places that you

[PHP] fileinfo returning wrong mime type for Excel files

2009-07-29 Thread Christoph Boget
Consider the following: $finfo = finfo_open( FILEINFO_MIME, '/usr/share/file/magic' ); if( $finfo ) { $mimeType = finfo_file( $finfo, '/path/to/my/excel.xls' ); finfo_close($finfo); } echo $mimeType; When I run the above, it echoes out

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-29 Thread Paul M Foster
On Wed, Jul 29, 2009 at 05:15:38PM -0400, Christoph Boget wrote: Consider the following: $finfo = finfo_open( FILEINFO_MIME, '/usr/share/file/magic' ); if( $finfo ) { $mimeType = finfo_file( $finfo, '/path/to/my/excel.xls' );