Uploading Files - set error messages - 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: Uploading Files - set error messages (/showthread.php?tid=55993) |
Uploading Files - set error messages - El Forum - 11-20-2012 [eluser]Rodolfo[/eluser] Hi, i'm trying to set my own error messages when something goes wrong on $this->upload->do_upload(); A part of my code is: $config = array('allowed_types' => 'jpg', 'upload_path' => $this->gallery_path, 'file_name' => $file_data.".jpg" ); $this->load->library('upload', $config); if(!$this->upload->do_upload()){ $this->loadIndex($this->upload->display_errors(), null); }else{ ... } everything works fine. when i select a file like image.png the display_errors() show me "The filetype you are attempting to upload is not allowed." but i wish to change that message to another one in portuguse, something like "Não é possível carregar o tipo ficheiro seleccionado.". Can you tell me how can i do that? Thank you, Rodolfo Gonçalves. Uploading Files - set error messages - El Forum - 11-20-2012 [eluser]Stojan[/eluser] Hi you allowed file types only 'jpg'. [quote author="Rodolfo" date="1353448888"] $config = array('allowed_types' => 'jpg', ......[/quote] You can add more types, something like that: Code: 'allowed_types' => 'gif|jpg|png'; Uploading Files - set error messages - El Forum - 11-20-2012 [eluser]skunkbad[/eluser] Read this to learn how to do what you want to do: http://ellislab.com/codeigniter/user-guide/libraries/language.html Uploading Files - set error messages - El Forum - 11-21-2012 [eluser]Rodolfo[/eluser] [quote author="skunkbad" date="1353477135"]Read this to learn how to do what you want to do: http://ellislab.com/codeigniter/user-guide/libraries/language.html[/quote] Many thanks to you skunbad your reply was very helpfull. In the system/language folder i could set my own error messages and solve the problem thanks man Uploading Files - set error messages - El Forum - 11-21-2012 [eluser]skunkbad[/eluser] [quote author="Rodolfo" date="1353491524"][quote author="skunkbad" date="1353477135"]Read this to learn how to do what you want to do: http://ellislab.com/codeigniter/user-guide/libraries/language.html[/quote] Many thanks to you skunbad your reply was very helpfull. In the system/language folder i could set my own error messages and solve the problem thanks man [/quote] You should actually put your own error messages in application/language. CodeIgniter is smart enough to use those before falling back on system/language. Uploading Files - set error messages - El Forum - 11-21-2012 [eluser]Rodolfo[/eluser] Yeah, that's what i was doing all this morning thanks to your reply it was very simple. i've just created a folder named "portuguese" in the application/language folder and in that folder i've created the file form_validation_lang and there i set all my error messages for validation form. The same i should do to the update_error messages. Thanks again |