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.
If I use mime check = false system information - class version : 0.26 - GD version : 2.0 - supported image types : png jpg gif bmp - open_basedir : no restriction - language : pt_BR source is an uploaded file - upload OK - file name OK - MIME type detected as text/plain by mime_content_type() - source variables file_src_name : C4.wmv file_src_name_body : C4 file_src_name_ext : wmv file_src_pathname : /tmp/phppMbKma file_src_mime : text/plain file_src_size : 1318800 (max= 33554432) file_src_error : 0 process file to ../img/Jobs/ - file size OK - script C4.wmv renamed as C4.wmv.txt! - file mime OK : text/plain - new file name body : 22f5ceeb - file name safe format - destination variables file_dst_path : ../img/Jobs/ file_dst_name_body : 22f5ceeb file_dst_name_ext : wmv.txt - no image operation, keep extension - checking for auto_rename - destination file details file_dst_name : 22f5ceeb.wmv.txt file_dst_pathname : ../img/Jobs/22f5ceeb.wmv.txt - 22f5ceeb.wmv.txt doesn't exist already - no image processing wanted - process OK
and if I use mimecheck = true and allowed = array('video/x-ms-wmv'); Incorrect type of file.system information - class version : 0.26 - GD version : 2.0 - supported image types : png jpg gif bmp - open_basedir : no restriction - language : pt_BR source is an uploaded file - upload OK - file name OK - MIME type detected as text/plain by mime_content_type() - source variables file_src_name : C4.wmv file_src_name_body : C4 file_src_name_ext : wmv file_src_pathname : /tmp/phpsj9uVa file_src_mime : text/plain file_src_size : 1318800 (max= 33554432) file_src_error : 0 process file to ../img/Jobs/ - file size OK - script C4.wmv renamed as C4.wmv.txt!
Why it understand text/plain if $_FILE["filename"]["type"] return video/x-ms-wmv!? o.O
Without mime check! system information - class version : 0.28RC4 - GD version : 2.0 - supported image types : png jpg gif bmp - open_basedir : no restriction - 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 video/x-ms-asf MIME type detected as video/x-ms-asf by UNIX file() command source variables - You can use all these before calling process() file_src_name : C4.wmv file_src_name_body : C4 file_src_name_ext : wmv file_src_pathname : /tmp/phpwgBjlU file_src_mime : video/x-ms-asf file_src_size : 1318800 (max= 33554432) file_src_error : 0 process file to ../img/Jobs/ - file size OK - file mime OK : video/x-ms-asf - new file name body : 200907290403443d0254fbe965da0309db543722f5ceeb - file name safe format - destination variables file_dst_path : ../img/Jobs/ file_dst_name_body : 200907290403443d0254fbe965da0309db543722f5ceeb file_dst_name_ext : wmv - no image operation, keep extension - checking for auto_rename - destination file details file_dst_name : 200907290403443d0254fbe965da0309db543722f5ceeb.wmv file_dst_pathname : ../img/Jobs/200907290403443d0254fbe965da0309db543722f5ceeb.wmv - 200907290403443d0254fbe965da0309db543722f5ceeb.wmv doesn't exist already - no image processing wanted - process OK
with $handle->allowed = array('video/x-ms-wmv', 'audio/mpeg3', 'audio/mpeg', 'image/*'); system information - class version : 0.28RC4 - GD version : 2.0 - supported image types : png jpg gif bmp - open_basedir : no restriction - 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 video/x-ms-asf MIME type detected as video/x-ms-asf by UNIX file() command source variables - You can use all these before calling process() file_src_name : C4.wmv file_src_name_body : C4 file_src_name_ext : wmv file_src_pathname : /tmp/phpiaUNL6 file_src_mime : video/x-ms-asf file_src_size : 1318800 (max= 33554432) file_src_error : 0 process file to ../img/Jobs/ - file size OK - error: Incorrect type of file.
with $handle->allowed = array('video/x-ms-wmv', 'video/x-ms-asf', 'audio/mpeg3', 'audio/mpeg', 'image/*');
system information - class version : 0.28RC4 - GD version : 2.0 - supported image types : png jpg gif bmp - open_basedir : no restriction - 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 video/x-ms-asf MIME type detected as video/x-ms-asf by UNIX file() command source variables - You can use all these before calling process() file_src_name : C4.wmv file_src_name_body : C4 file_src_name_ext : wmv file_src_pathname : /tmp/phpTIq3bl file_src_mime : video/x-ms-asf file_src_size : 1318800 (max= 33554432) file_src_error : 0 process file to ../img/Jobs/ - file size OK - file mime OK : video/x-ms-asf - new file name body : 200907290410013d0254fbe965da0309db543722f5ceeb - file name safe format - destination variables file_dst_path : ../img/Jobs/ file_dst_name_body : 200907290410013d0254fbe965da0309db543722f5ceeb file_dst_name_ext : wmv - no image operation, keep extension - checking for auto_rename - destination file details file_dst_name : 200907290410013d0254fbe965da0309db543722f5ceeb.wmv file_dst_pathname : ../img/Jobs/200907290410013d0254fbe965da0309db543722f5ceeb.wmv - 200907290410013d0254fbe965da0309db543722f5ceeb.wmv doesn't exist already - no image processing wanted - process OK
Now it works fine... congratulation about you fast reply and this magnificent classReply
If I use mime check = false
system information
- class version : 0.26
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : pt_BR
source is an uploaded file
- upload OK
- file name OK
- MIME type detected as text/plain by mime_content_type()
- source variables
file_src_name : C4.wmv
file_src_name_body : C4
file_src_name_ext : wmv
file_src_pathname : /tmp/phppMbKma
file_src_mime : text/plain
file_src_size : 1318800 (max= 33554432)
file_src_error : 0
process file to ../img/Jobs/
- file size OK
- script C4.wmv renamed as C4.wmv.txt!
- file mime OK : text/plain
- new file name body : 22f5ceeb
- file name safe format
- destination variables
file_dst_path : ../img/Jobs/
file_dst_name_body : 22f5ceeb
file_dst_name_ext : wmv.txt
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 22f5ceeb.wmv.txt
file_dst_pathname : ../img/Jobs/22f5ceeb.wmv.txt
- 22f5ceeb.wmv.txt doesn't exist already
- no image processing wanted
- process OK
and if I use mimecheck = true and allowed = array('video/x-ms-wmv');
Incorrect type of file.system information
- class version : 0.26
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : pt_BR
source is an uploaded file
- upload OK
- file name OK
- MIME type detected as text/plain by mime_content_type()
- source variables
file_src_name : C4.wmv
file_src_name_body : C4
file_src_name_ext : wmv
file_src_pathname : /tmp/phpsj9uVa
file_src_mime : text/plain
file_src_size : 1318800 (max= 33554432)
file_src_error : 0
process file to ../img/Jobs/
- file size OK
- script C4.wmv renamed as C4.wmv.txt!
Why it understand text/plain if $_FILE["filename"]["type"] return video/x-ms-wmv!? o.O
Thanks for the help, and great class =)
Without mime check!
system information
- class version : 0.28RC4
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- 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 video/x-ms-asf
MIME type detected as video/x-ms-asf by UNIX file() command
source variables
- You can use all these before calling process()
file_src_name : C4.wmv
file_src_name_body : C4
file_src_name_ext : wmv
file_src_pathname : /tmp/phpwgBjlU
file_src_mime : video/x-ms-asf
file_src_size : 1318800 (max= 33554432)
file_src_error : 0
process file to ../img/Jobs/
- file size OK
- file mime OK : video/x-ms-asf
- new file name body : 200907290403443d0254fbe965da0309db543722f5ceeb
- file name safe format
- destination variables
file_dst_path : ../img/Jobs/
file_dst_name_body : 200907290403443d0254fbe965da0309db543722f5ceeb
file_dst_name_ext : wmv
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 200907290403443d0254fbe965da0309db543722f5ceeb.wmv
file_dst_pathname : ../img/Jobs/200907290403443d0254fbe965da0309db543722f5ceeb.wmv
- 200907290403443d0254fbe965da0309db543722f5ceeb.wmv doesn't exist already
- no image processing wanted
- process OK
with $handle->allowed = array('video/x-ms-wmv', 'audio/mpeg3', 'audio/mpeg', 'image/*');
system information
- class version : 0.28RC4
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- 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 video/x-ms-asf
MIME type detected as video/x-ms-asf by UNIX file() command
source variables
- You can use all these before calling process()
file_src_name : C4.wmv
file_src_name_body : C4
file_src_name_ext : wmv
file_src_pathname : /tmp/phpiaUNL6
file_src_mime : video/x-ms-asf
file_src_size : 1318800 (max= 33554432)
file_src_error : 0
process file to ../img/Jobs/
- file size OK
- error: Incorrect type of file.
with $handle->allowed = array('video/x-ms-wmv', 'video/x-ms-asf', 'audio/mpeg3', 'audio/mpeg', 'image/*');
system information
- class version : 0.28RC4
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- 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 video/x-ms-asf
MIME type detected as video/x-ms-asf by UNIX file() command
source variables
- You can use all these before calling process()
file_src_name : C4.wmv
file_src_name_body : C4
file_src_name_ext : wmv
file_src_pathname : /tmp/phpTIq3bl
file_src_mime : video/x-ms-asf
file_src_size : 1318800 (max= 33554432)
file_src_error : 0
process file to ../img/Jobs/
- file size OK
- file mime OK : video/x-ms-asf
- new file name body : 200907290410013d0254fbe965da0309db543722f5ceeb
- file name safe format
- destination variables
file_dst_path : ../img/Jobs/
file_dst_name_body : 200907290410013d0254fbe965da0309db543722f5ceeb
file_dst_name_ext : wmv
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 200907290410013d0254fbe965da0309db543722f5ceeb.wmv
file_dst_pathname : ../img/Jobs/200907290410013d0254fbe965da0309db543722f5ceeb.wmv
- 200907290410013d0254fbe965da0309db543722f5ceeb.wmv doesn't exist already
- no image processing wanted
- process OK
Now it works fine... congratulation about you fast reply and this magnificent class