Welcome Guest, Not a member yet? Register   Sign In
Upload TIF in IE 6
#1

[eluser]Unknown[/eluser]
Hi!

When I try to upload a tif image in IE 6, CI Upload class returns a file type error(The filetype you are attempting to upload is not allowed), although the config is set to accept tiff, tif file types.

Code:
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png|bmp|tiff|tif';
$this->load->library('upload', $config);

if (!$this->upload->do_upload('image'))
{
   // handle error
}
else
{
   // handle success
}

This only happens on IE 6, on Firefox 2,3 works fine. Is it a browser bug?...
I couldn't find any helpful information on this, so if you have any answers or references, thanks in advance.

Have a good day!
#2

[eluser]Rick Jolly[/eluser]
You'll have to find out the mime type being sent by IE 6 and add it to config/mimes.php. I had a similar problem with uploading a jpeg of all things. It turned out I had to add "image/jpg" to the mimes.php file which only had "image/jpeg" and "image/pjpeg" at the time.

Edit:
Currently, I only see "image/tiff" in mimes.php. You might have to change it to an array and add "image/tif".
Code:
// maybe change this:
'tiff'    =>    'image/tiff',
'tif'    =>    'image/tiff',
// to this:
'tiff'    =>    array('image/tiff', 'image/tif'),
'tif'    =>    array('image/tiff', 'image/tif'),
#3

[eluser]Unknown[/eluser]
[solved]

Hi!

Thanks for your answer. I changed the mimes array as you said,
from
Code:
'tiff' => 'image/tiff',
'tif'  => 'image/tiff',
to
Code:
'tiff' => array('image/tiff', 'image/x-tiff', 'application/octet-stream'),
'tif'  => array('image/tiff', 'image/x-tiff', 'application/octet-stream'),
and it worked.
It seems that in IE6 when uploading TIF files, the content type comes up as application/octet-stream instead of image/tif ...
Thanks again for your help.

Have a good day!

Edit: after some tests I found out that also text/plain can occur for TIF files in IE6
Code:
'tiff' => array('image/tiff', 'image/x-tiff', 'application/octet-stream', 'text/plain'),
'tif'  => array('image/tiff', 'image/x-tiff', 'application/octet-stream', 'text/plain'),




Theme © iAndrew 2016 - Forum software by © MyBB