I am trying to upload 2 files through a codeigniter controller. When i select the files and hit submit it always returns error. But when i do a var_dump($_FILES); it shows that the files are passing but not being captured by the codeigniter controller.
Can someone tell me what i am doing wrong? Below is my code
$config['upload_path'] = './docs/';
$config['allowed_types'] = 'jpg|doc|docx';
$config['max_size'] = 10000;
$config['max_width'] = 3000;
$config['max_height'] = 3000;
$this->load->library('upload', $config);
if ( !$this->upload->do_upload('userfile1') || !$this->upload->do_upload('userfile2'))
{
echo "error";
} else {
$f1= $this->upload->data('userfile1');
$f2= $this->upload->data('userfile2');
echo $f1['file_name'];
echo $f2['file_name'];
}