class "thinking" that png i txt

See all posts See thread Reply

Re: class "thinking" that png i txt new!
by baambaam, 12 years, 6 months ago
with $foo->allowed = array('image/jpeg','image/jpg','image/gif','image/png','image/bmp');

system information
- class version : 0.31
- operating system : Linux
- PHP version : 5.2.17
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is a local file /home/tmp/phpGWFVUT
- local 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
PHP exec() function is disabled
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as text/plain by mime_content_type()
- MIME validated as text/plain
source variables
- You can use all these before calling process()
file_src_name : phpGWFVUT
file_src_name_body : phpGWFVUT
file_src_name_ext :
file_src_pathname : /home/tmp/phpGWFVUT
file_src_mime : text/plain
file_src_size : 37833 (max= 67108864)
file_src_error : 0
process file to ./upload/gotowe/2012/05/
- file size OK
- file renamed as phpGWFVUT.txt!
- error: Incorrect type of file.


and without:
system information
- class version : 0.31
- operating system : Linux
- PHP version : 5.2.17
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is a local file /home/tmp/php8TsHdL
- local 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
PHP exec() function is disabled
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as text/plain by mime_content_type()
- MIME validated as text/plain
source variables
- You can use all these before calling process()
file_src_name : php8TsHdL
file_src_name_body : php8TsHdL
file_src_name_ext :
file_src_pathname : /home/tmp/php8TsHdL
file_src_mime : text/plain
file_src_size : 37833 (max= 67108864)
file_src_error : 0
process file to ./upload/gotowe/2012/05/
- file size OK
- file renamed as php8TsHdL.txt!
- file mime OK : text/plain
- new file name body : 4fb2c7d655b72
- file name safe format
- destination variables
file_dst_path : ./upload/gotowe/2012/05/
file_dst_name_body : 4fb2c7d655b72
file_dst_name_ext : txt
- checking for auto_rename
- destination file details
file_dst_name : 4fb2c7d655b72.txt
file_dst_pathname : ./upload/gotowe/2012/05/4fb2c7d655b72.txt
- 4fb2c7d655b72.txt doesn't exist already
- no image processing wanted
- process OK
Reply
Re: class "thinking" that png i txt new!
by colin, 12 years, 6 months ago
You PHP instance is wrongly configured, the MIME types detection is incorrect. The function mime_content_type() bases its detection on the mime.magic file, you may want to check that. Note that this is now deprecated in favor of PECL FileInfo, which your sstem doesn't seem to have.Reply