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

Let me show you mine :

For the View :
Code:
<input type="file" multiple name="userfile[]" size="20"/>

For the controller :
Code:
$upload['upload_path'] = './uploads/';
$upload['allowed_types'] = 'gif|jpg|png';
$upload['max_size'] = 10000;
$upload['max_width'] = 4000;
$upload['max_height'] = 3000;

$files = $_FILES;
$count = count($_FILES['userfile']['name']);

for($i = 0; $i < $count; $i++) {
   $_FILES['userfile']['name']= $files['userfile']['name'][$i];
   $_FILES['userfile']['type']= $files['userfile']['type'][$i];
   $_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
   $_FILES['userfile']['error']= $files['userfile']['error'][$i];
   $_FILES['userfile']['size']= $files['userfile']['size'][$i];    
   $this->upload->initialize($upload);
   $this->upload->do_upload();
}

Try upload some pics, if the pics you choose goes to 'uploads' folder, you did it
If it works for me, it should work for you too :)
Reply


Messages In This Thread
RE: How to perform the upload with multiple files - by rikyperdana - 08-21-2016, 11:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB