0

I have this error, Fatal error: Call to undefined method CI_Input::file() in D:\xampp\htdocs\application\controllers\page.php on line 219 and use from Multiple Uploads with JQuery and Code Igniter and Extended Input for Files

This is my code:

if($this->input->file('userfile')){ //This is line 219
    $config['upload_path'] = './uploads/'; 
    $config['allowed_types'] = 'gif|jpg|png'; 
    $config['max_size']    = '1000'; 
    $config['max_width']  = '1024';
    $config['max_height']  = '768';

    $this->upload->initialize($config);
    $this->load->library('Multi_upload');

    $files = $this->multi_upload->go_upload();
    //var_dump($files);
    if ( ! $files )
    {
        $error = $this->upload->display_errors();                           
        echo $error;
        return false;
    }
    else
    {
        $data3 = array();
        foreach ($files as $idx => $name) {
            //var_dump($name['name']);
            $data3[] = array(
                'relation' => $id_residence,
                'images' => $name['name'],
            );
        };
        $data333 = $this->db->insert_batch('hotel_image', $data3);
    }
}
Jennifer Anthony
  • 2,227
  • 10
  • 37
  • 56

1 Answers1

0

Instead of isset()

try:

$myInput = $this->input->file('userfile');
if(!empty($myInput)){
    ...
    ...
}
Ghazanfar Mir
  • 3,493
  • 2
  • 26
  • 42
  • Just checked it, you may have a look at CodeIgniter File Upload: [link] (http://codeigniter.com/user_guide/libraries/file_uploading.html) [link] – Ghazanfar Mir Oct 12 '11 at 14:49