CodeIgniter Forums
Upload class won't upload .ico - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Upload class won't upload .ico (/showthread.php?tid=562)



Upload class won't upload .ico - Razza - 12-18-2014

I'm trying to upload .ico files using the upload class, however, it returns 'The filetype you are attempting to upload is not allowed.' as the error.

I have updated the mimes.php file array with the following:
PHP Code:
'ico'   =>  array('image/ico''image/x-icon''application/ico''application/x-ico''application/x-win-bitmap''image/x-win-bitmap''application/octet-stream'), 

Here is my current code:
PHP Code:
$config['upload_path'] = 'files/';
$config['allowed_types'] = 'ico';
$config['max_size'] = '2000';
$config['max_width'] = '0';
$config['max_height'] = '0';
$this->load->library('upload'$config);
if (
$this->upload->do_upload('icon'))
{
 die(
'ok');
}
else
{
 die(
$this->upload->display_errors());


Any help is appreciated. Thank you.


RE: Upload class won't upload .ico - Rufnex - 12-18-2014

I just tried it and it works with your mime settings .. i tested it with CI 3 dev. What Version do you use?


RE: Upload class won't upload .ico - Razza - 12-18-2014

(12-18-2014, 02:19 PM)Rufnex Wrote: I just tried it and it works with your mime settings .. i tested it with CI 3 dev. What Version do you use?

I'm using CI 2. There should be a way on CI 2 also as all other file types work.


RE: Upload class won't upload .ico - libreteam_studio - 12-18-2014

can you show me your total code (even form view code)?


RE: Upload class won't upload .ico - Avenirer - 12-22-2014

On that array, shouldn't you also add the value: 'image/vnd.microsoft.icon'?