Hi
I'm able to do multiple uploads using the following codes (bellow). on $config (req. var in $this->process_file_upload($field_file_name, $config)), i set allowed file types to "jpg|gif|png". So, when i test and upload files like in "file.htm, file.txt and then file.jpg". basically, files with ".htm" and ".txt" will not be uploaded. arrays $data[0]['error'] and arrays $data[2]['error'] should each have value "The filetype you are attempting to upload is not allowed." but what is happining is that arrays $data[2]['error'] kind'a concatenate value from $data[0]['error'], is this normal?
Please see my attached file showing my dump result.
Thanks,
vrsotto
I'm able to do multiple uploads using the following codes (bellow). on $config (req. var in $this->process_file_upload($field_file_name, $config)), i set allowed file types to "jpg|gif|png". So, when i test and upload files like in "file.htm, file.txt and then file.jpg". basically, files with ".htm" and ".txt" will not be uploaded. arrays $data[0]['error'] and arrays $data[2]['error'] should each have value "The filetype you are attempting to upload is not allowed." but what is happining is that arrays $data[2]['error'] kind'a concatenate value from $data[0]['error'], is this normal?
Please see my attached file showing my dump result.
PHP Code:
for ($count = 0; $count < $number_of_files; $count++) {
$this->load->library('upload', $config);
$_FILES[$field_file_name]['name'] = $files['name'][$count];
$_FILES[$field_file_name]['type'] = $files['type'][$count];
$_FILES[$field_file_name]['tmp_name'] = $files['tmp_name'][$count];
$_FILES[$field_file_name]['error'] = $files['error'][$count];
$_FILES[$field_file_name]['size'] = $files['size'][$count];
$data[] = $this->process_file_upload($field_file_name, $config);
}
dump($data); // dump() is same as print_r(), a custom function
public function process_file_upload($field_file_name, $config = array()) {
// Process Upload(s)
if ($this->upload->do_upload($field_file_name)) {
$data['upload'] = $this->upload->data();
} else {
$data['error'] = $this->upload->display_errors();
}
return $data;
}
Thanks,
vrsotto