Welcome Guest, Not a member yet? Register   Sign In
How upload *.ico file?
#1

[eluser]xintrea[/eluser]
Hi all!


I dont known how upload ico file in CodeIgniter.

In my code i try use next allowed_types set:

Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|ico|icon|image|image/ico';

But *.ico file don't uploading. CI show error: "The filetype you are attempting to upload is not allowed".


How writing to allowed_types string for *.ico file uploading worked?
#2

[eluser]flaky[/eluser]
instead of
Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|ico|icon|image|image/ico';

try this
Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|ico|icon|image|image|ico';
#3

[eluser]xintrea[/eluser]
[quote author="flaky" date="1272990306"]instead of
Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|ico|icon|image|image/ico';

try this
Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|ico|icon|image|image|ico';
[/quote]

No, this already not work.

Incidentally, "image/ico" - it is ICO mime type, see http://en.wikipedia.org/wiki/ICO_(file_format).

Any other ideas?
#4

[eluser]danmontgomery[/eluser]
You have to add the ico extension to config/mimes.php. The only valid parameters in $config['allowed_types'] are extensions. icon|image|image/ico will all be ignored.
#5

[eluser]xintrea[/eluser]
[quote author="noctrum" date="1273014172"]You have to add the ico extension to config/mimes.php. The only valid parameters in $config['allowed_types'] are extensions. icon|image|image/ico will all be ignored.[/quote]

I add to config/mimes.php to $mimes array variable next data:

Code:
...,
'ico'=>array('image/vnd.microsoft.icon',
             'image/ico',
             'image/icon',
             'text/ico',
             'application/ico',
             'image/x-icon'),
...,

and write "allowed_types" as:

Code:
$config['allowed_types']='gif|jpg|png|ico';

but already not work.

*.png/*.jpg/*.gif upload normally, but *.ico can't uploading.
#6

[eluser]danmontgomery[/eluser]
http://itlivewire.com/devblog/2010/04/13...t-allowed/ You can follow these steps to determine what the mime type should be. There have also been recent posts about a bug with listing image types first along with other filetypes for the upload class... You might need to put ico first.
#7

[eluser]xintrea[/eluser]
[quote author="noctrum" date="1273018574"]http://itlivewire.com/devblog/2010/04/13...t-allowed/ You can follow these steps to determine what the mime type should be. There have also been recent posts about a bug with listing image types first along with other filetypes for the upload class... You might need to put ico first.[/quote]

I determine mime type, ico-file detect as "image/x-icon".

If allowed_types set to
Code:
"ico|gif|jpg|png"

then ico-file normally uploaded. And png-file normally uploaded.


If allowed_types set to
Code:
"gif|jpg|png|ico"
then ico-file can't uploaded. Png-file normally uploaded.


There is unambiguously bug.
#8

[eluser]InsiteFX[/eluser]
Hi,

Try this:

Code:
// Add this to your .htaccess file.

AddType image/x-icon .ico

On unix and linux server you may need to use all lowercase.

You can add other mime types the same way.

InsiteFX
#9

[eluser]danmontgomery[/eluser]
[quote author="xintrea" date="1273021323"][quote author="noctrum" date="1273018574"]http://itlivewire.com/devblog/2010/04/13...t-allowed/ You can follow these steps to determine what the mime type should be. There have also been recent posts about a bug with listing image types first along with other filetypes for the upload class... You might need to put ico first.[/quote]

I determine mime type, ico-file detect as "image/x-icon".

If allowed_types set to
Code:
"ico|gif|jpg|png"

then ico-file normally uploaded. And png-file normally uploaded.


If allowed_types set to
Code:
"gif|jpg|png|ico"
then ico-file can't uploaded. Png-file normally uploaded.


There is unambiguously bug.[/quote]

Yep, one that's been fixed in 2.0
#10

[eluser]Unknown[/eluser]
I set
'ico' => array('image/ico', 'image/x-icon'), in config/mimes.php
and
$config['allowed_types'] = 'ico|jpg|png'; in my controller

Working...Smile






Theme © iAndrew 2016 - Forum software by © MyBB