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've been playing around with the upload class for a bit now and things seems to work pretty well. I added the application/msword MIME-type to the allowed list, but as soon as I try to upload a .docx file, it throws an error saying "Incorrect type of file".
This is the error log it produces: - class version : 0.29 - operating system : Linux - PHP version : 5.2.8 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : /home/website:/opt/php4/lib/php:/opt/php5/lib/php:/nfs/sessions:/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 type detected as application/x-zip by UNIX file() command - MIME validated as application/x-zip source variables - You can use all these before calling process() file_src_name : oink.docx file_src_name_body : oink file_src_name_ext : docx file_src_pathname : /tmp/phpOoHGPf file_src_mime : application/x-zip file_src_size : 10078 (max= 16777216) file_src_error : 0 process file and return the content - file size OK - error: Incorrect type of file.
I've been playing around with the upload class for a bit now and things seems to work pretty well. I added the application/msword MIME-type to the allowed list, but as soon as I try to upload a .docx file, it throws an error saying "Incorrect type of file".
This is the error log it produces:
- class version : 0.29
- operating system : Linux
- PHP version : 5.2.8
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : /home/website:/opt/php4/lib/php:/opt/php5/lib/php:/nfs/sessions:/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 type detected as application/x-zip by UNIX file() command
- MIME validated as application/x-zip
source variables
- You can use all these before calling process()
file_src_name : oink.docx
file_src_name_body : oink
file_src_name_ext : docx
file_src_pathname : /tmp/phpOoHGPf
file_src_mime : application/x-zip
file_src_size : 10078 (max= 16777216)
file_src_error : 0
process file and return the content
- file size OK
- error: Incorrect type of file.
What should I do to fix this problem?