Error detecting MIME type with UNIX file() command

See all posts Reply

Error detecting MIME type with UNIX file() command new!
by Eugenio, 14 years, 10 months ago
I have some troubles with mime type detection when uploading a file that is 'application/msword'.
Next is the printing of the class.upload log var after the operation:

system information
- class version : 0.27
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : es_ES
source is an uploaded file
- upload OK
- file name OK
- MIME type detected as application/msword application/msword by UNIX file() command
- source variables
file_src_name : comentarioskilkenny.doc
file_src_name_body : comentarioskilkenny
file_src_name_ext : doc
file_src_pathname : /tmp/phpOxmR5s
file_src_mime : application/msword application/msword
file_src_size : 60416 (max= 8388608)
file_src_error : 0

You can notice the file_src_mime as 'application/msword application/msword'. Could it be an error because of the file is weird? I have tried with many other files, and the mime type detected is the same. Or is it an error of the detection algorythm? Do I have to report it as a bug? where?

Hope someone can help. Cheers.
Eugenio FioritiReply
Re: Error detecting MIME type with UNIX file() command new!
by colin, 14 years, 10 months ago
The UNIX file command seems to give unreliable results sometimes. I will fix this in the next release, which I hope to get out in a few days.

You said you tried with other files, and it gave the same results (the MIME type is duplicated). Can you give me one or two more examples?

On what platform are you? Can you give me the output of file -v?Reply
Re: Error detecting MIME type with UNIX file() command new!
by colin, 14 years, 10 months ago
New release candidate 0.28RC3 should fix this bug.Reply
Re: Error detecting MIME type with UNIX file() command new!
by Eugenio, 14 years, 10 months ago
Colin: thank you very much for your quick and useful answer!
The new release seems to work great.
I've tried with many msword documents from different MSOffice versions (2003, 2007 and XP) and the error reported was the same.
I also have an image uploader that works ok with class.upload, it has no problem with mime types.
I'll try to collect more detailed information. The platform where my application is loades is a Linux llge328.

Thanks again for your answer.Reply
Re: Error detecting MIME type with UNIX file() command new!
by Eugenio, 14 years, 10 months ago
PS: when I was talking about the errors in the previos reply, I was always referring to the previous version of class.upload I was using. =)
Release candidate 0.28RC3 is doing a great job till now.

Cheers!Reply