CodeIgniter Forums
image form validation -> config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: image form validation -> config (/thread-40952.html)



image form validation -> config - El Forum - 04-23-2011

[eluser]DaTran[/eluser]
I have this in my controller; as you can see i am using the form validation config file to call all validations.

Code:
if($this->form_validation->run('anime/add') == TRUE){
        
        if($this->anime_model->add($this->input->post())){
          if($this->upload->do_upload('image')){
            $template['result'] = TRUE;
          }
        }
}

How do I use the form validation to "require" the
Code:
<input type="file" name="image" size="20" />
field. (views page)
It keeps saying that there is no image selected.

I am also using MY_Form_validation.php to call in custom validations.


image form validation -> config - El Forum - 04-25-2011

[eluser]toopay[/eluser]
Code:
$this->form_validation->set_rules('image', 'Image', 'required');