Welcome Guest, Not a member yet? Register   Sign In
How uploading many files?
#2

[eluser]xwero[/eluser]
You can only validate/upload one file at the time using the upload class so you would have to do something like this
Code:
$fields = array('userfile','videofile');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size']    = '100';
$config['max_width']  = '1024';
$config['max_height']  = '768';
$config2['upload_path'] = './uploads/';
$config2['allowed_types'] = 'avi|wmv|mov';
foreach($fields as $field)
{
   if(isset($_FILES[$field]))
   {
      switch($field)
      {
         case 'userfile':
           $this->load->library('upload', $config);
    
        if ( ! $this->upload->do_upload())
        {
            // error
        }    
        else
        {
            // success
        }
           break;
         case 'videofile':
           $this->load->library('upload', $config2);
    
        if ( ! $this->upload->do_upload())
        {
            // error
        }    
        else
        {
            // success
        }
           break;
      }
   }
}

It's a bit messy but i think you get the picture.


Messages In This Thread
How uploading many files? - by El Forum - 11-03-2007, 02:03 PM
How uploading many files? - by El Forum - 11-03-2007, 03:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB