Incorrect type of file

See all posts Reply

Incorrect type of file new!
by Paulo Coutinho, 15 years, 3 months ago
I search and try some solutions, but no success, so i have to post here my problem.

I try to post a EXE file and get this error on this screenshot:
http://prsolucoes.com/downloads/erro_upload_verot.jpg

-Incorrect type of file-

Anyone can help me?Reply
Re: Incorrect type of file new!
by colin, 15 years, 3 months ago
Look in the logs produced by the class.
echo $handle->log;
Reply
Re: Incorrect type of file new!
by Chris Wood, 15 years, 3 months ago
I've noticed this error with version 0.27 also. I have successfully used this class v0.25 and v0.26 in this script. I noticed this error uploading an MS Word 2003 document.

My log give this:
Error: Incorrect type of file.
LOG: system information
- class version : 0.27
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
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 : Illinois WS.doc
file_src_name_body : Illinois WS
file_src_name_ext : doc
file_src_pathname : /tmp/php7pbDYm
file_src_mime : application/msword application/msword
file_src_size : 30208 (max= 67108864)
file_src_error : 0
process file to ../forms/
- file size OK


The MIME type detected repeats the name twice "application/msword application/msword"
I added the MIME type doubled ("application/msword application/msword") and the upload was allowed. I tested with IE8 and Firefox 3 to rule out browser error. My PC has Word 2007 installed, and this is a Word 2003 file. I have not yet tested other Office Application Documents.Reply
Re: Incorrect type of file new!
by colin, 15 years, 3 months ago
Can you try with this new version 0.28RC4? This problem should be fixed. it is due to a bug in the file command.Reply
Re: Incorrect type of file new!
by Chris Wood, 15 years, 3 months ago
v0.28 does correct the issue.Reply
Re: Incorrect type of file new!
by Gigi, 15 years, 2 months ago
Hello,

I have same problem with .ZIP files
Until 2-3 weeks it worked perfectly, but now not.


system information
- class version : 0.28
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : /home/cinema/:/usr/lib/php:/usr/local/lib/php:/tmp
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME returned as application/x-zip
MIME type detected as application/x-zip by UNIX file() command
source variables
- You can use all these before calling process()
file_src_name : G-Force.zip
file_src_name_body : G-Force
file_src_name_ext : zip
file_src_pathname : /tmp/phpw5VEIT
file_src_mime : application/x-zip
file_src_size : 116112 (max= 6291456)
file_src_error : 0
process file to ../storage/file/2009-09/
- file size OK
- error: Incorrect type of file.


Please help meReply
Re: Incorrect type of file new!
by colin, 15 years, 2 months ago
Just add "application/x-zip" in the list of allowed MIME types (around line 2070)Reply
Re: Incorrect type of file new!
by Gigi, 15 years, 2 months ago
Thanks a lot. Now it works perfectlyReply