CodeIgniter Forums
Need Help in multiple file upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need Help in multiple file upload (/showthread.php?tid=46015)



Need Help in multiple file upload - El Forum - 10-14-2011

[eluser]Mistry007[/eluser]
hi i am having trouble while uploading multiple file.

here are my code

Code:
if($this->input->post('btnUpload'))
{
$this->load->library('upload');
$totalfiles = count($_FILES['userfile']['name']);
for($i=0; $i < $totalfiles; $i++)
{
    $config['file_name']     = 'test_'.$i;
    $config['upload_path']   = $this->uploadpath;
    $config['allowed_types'] = 'jpg|jpeg|gif|png';
    $config['max_size'] = '10000';
    $config['max_width']  = '1024';
    $config['max_height']  = '768';
    $config['overwrite']     = FALSE;
    $this->upload->initialize($config);
        
    if($this->upload->do_upload())
    {
      $file_data = $this->upload->data();
     }else
     {
   $error = array('error' => $this->upload->display_errors());
        print_r($error);
     }
  }
}

Note :- It will display error that "You did not select a file to upload."
Can Any one help me out ?