Uploading Files - set error messages |
[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.
[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';
[eluser]skunkbad[/eluser]
Read this to learn how to do what you want to do: http://ellislab.com/codeigniter/user-gui...guage.html
[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-gui...guage.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
[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-gui...guage.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.
[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 |
Welcome Guest, Not a member yet? Register Sign In |