Codeigniter Upload File not working
The first thing you have to put the name of the file field.
<input type="file" name="image"/>$this->upload->do_upload('image');
Second, you can not have the max_width and max height 0
$config['max_width'] = '2048';$config['max_height'] = '2048';
Try that first and then see
For validate field file:
if($_FILES['you_field_name']['tmp_name']){ //your code }
A greeting
Try this one check if $_FILES
is not empty then do the validation else do nothing
$my_rules = array( array( 'field' => 'title', 'label' => 'Title', 'rules' => 'required|min_length[5]|max_length[20]|xss_clean' ) );if(!empty($_FILES)){ $my_rules[]= array( 'field' => 'additionalUpload', 'label' => 'Additional Upload', 'rules' => 'callback_is_image' )}$this->form_validation->set_rules($my_rules);
In your upload function you need to specify the field name
$this->upload->do_upload('your_field_name')