How would I upload an array of files with CodeIgniter? I have a form where I want users to be able to upload more than one file at a time. I have a javascript code that adds an extra file input field named "files[]" when they click on a submit button. This is the code I have so far, but it always says that I didn't select a file to upload in the display_errors function.
<code>
foreach($this->input->post('files') as $i => $file){
$config = array( //Preferences to validate the image before uploading it
'upload_path' => './attachments',
'allowed_types' => 'jpg|gif|bmp',
'max_size' => '100',
'max_width' => '950',
'max_height' => '631',
'overwrite' => FALSE,
'encrypt_name' => TRUE,
'remove_spaces' => TRUE
);
$this->load->library('upload', $config);
if($this->upload->do_upload('files['.$i.']')){
echo $this->upload->file_data();
} else {
echo $this->upload->display_errors('<li>', '</li>');
}
}
</code>