Welcome Guest, Not a member yet? Register   Sign In
How to perform the upload with multiple files
#1

I use the following code in my form .

Code:
<input type="file" name="bbs_images[]">
<input type="file" name="bbs_images[]">


I tried

PHP Code:
$this->upload->do_upload('bbs_images'); 

and got 

Code:
Message: is_uploaded_file() expects parameter 1 to be string, array given


I also tried
PHP Code:
$this->upload->do_upload('bbs_images[0]'); 
 but it also returned false because do_upload would finally try to access $_FILES['bbs_images'][0] and finally got NULL.

So, How could I use Upload::do_upload since the structure of $_FILES['bbs_images'] is as follows ?


PHP Code:
array (size=5)
 
 'name' => 
 
   array (size=2)
 
     0 => string 'XXX.xls'
 
     1 => string 'XXX.sql'
 
 'type' => 
 
   array (size=2)
 
     0 => string 'XXX'
 
     1 => string 'XXX'
 
 'tmp_name' => 
 
   array (size=2)
 
     0 => string 'XXX'
 
     1 => string 'XXX'
 
 'error' => 
 
   array (size=2)
 
     0 => int 0
      1 
=> int 0
  
'size' => 
 
   array (size=2)
 
     0 => int XX
      1 
=> int XXX 
Reply


Messages In This Thread
How to perform the upload with multiple files - by tianhe - 07-29-2016, 02:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB