class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
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!
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.
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.
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 Fioriti
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?
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.
Release candidate 0.28RC3 is doing a great job till now.
Cheers!