• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading Files - set error messages

#1
[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.

#2
[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';


#3
[eluser]skunkbad[/eluser]
Read this to learn how to do what you want to do:

http://ellislab.com/codeigniter/user-gui...guage.html

#4
[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 Smile your reply was very helpfull. In the system/language folder i could set my own error messages and solve the problem Smile

thanks man Big Grin

#5
[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 Smile your reply was very helpfull. In the system/language folder i could set my own error messages and solve the problem Smile

thanks man Big Grin[/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.

#6
[eluser]Rodolfo[/eluser]
Yeah, that's what i was doing all this morning thanks to your reply Smile 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 Big Grin


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.