![]() |
How upload *.ico file? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How upload *.ico file? (/showthread.php?tid=30131) Pages:
1
2
|
How upload *.ico file? - El Forum - 05-04-2010 [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? How upload *.ico file? - El Forum - 05-04-2010 [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'; How upload *.ico file? - El Forum - 05-04-2010 [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? How upload *.ico file? - El Forum - 05-04-2010 [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. How upload *.ico file? - El Forum - 05-04-2010 [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. How upload *.ico file? - El Forum - 05-04-2010 [eluser]danmontgomery[/eluser] http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-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. How upload *.ico file? - El Forum - 05-04-2010 [eluser]xintrea[/eluser] [quote author="noctrum" date="1273018574"]http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-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. How upload *.ico file? - El Forum - 05-04-2010 [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 How upload *.ico file? - El Forum - 05-04-2010 [eluser]danmontgomery[/eluser] [quote author="xintrea" date="1273021323"][quote author="noctrum" date="1273018574"]http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-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 How upload *.ico file? - El Forum - 01-15-2014 [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... ![]() |