How upload *.ico file? |
[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?
[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';
[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'; 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?
[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.
[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: ..., 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.
[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.
[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" There is unambiguously bug.
[eluser]InsiteFX[/eluser]
Hi, Try this: Code: // Add this to your .htaccess file. On unix and linux server you may need to use all lowercase. You can add other mime types the same way. InsiteFX
[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" There is unambiguously bug.[/quote] Yep, one that's been fixed in 2.0
[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... ![]() |
Welcome Guest, Not a member yet? Register Sign In |