Udders
Udders

Reputation: 259

codeigniter file upload

I am doing the following to upload a file(image) using codeigniter. What I am wanting to do is modify the error message so that it obvious which field the error relates too as there are multiple upload options on the page, below is my upload code,

$config['upload_path'] = './media/uploads/users';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '1000';
            $config['max_width']  = '90';
            $config['max_height']  = '60';

            $this->upload->initialize($config);

            if(!$this->upload->do_upload('logo_small'))
            {
                $error = array('error' => $this->upload->display_errors());
                $this->template->build('users/employer', $error);
            }
            else
            {
                $file = $this->upload->data();
                $logo_small = "small_".$file['file_name'];
            }

So basically I want there error message to state Logo Small in the error message, and then if the error relates to Logo large etc I would want it to state that.

Upvotes: 3

Views: 4217

Answers (1)

Vamsi Krishna B
Vamsi Krishna B

Reputation: 11500

easiest way is to edit system/language/english/upload_lang.php with the error message you want. enter image description here

Upvotes: 2

Related Questions