When I upload I can upload single files fine but, I cannot seem to upload if input is like <input type="file" name="file[]">
I am not sure on my php upload function how to make it allow multiple files?
Thanks in advance.
public function upload() {
$this->load->library('request');
$directory = FCPATH .'upload/';
$full_path = $directory . basename($this->request->files['file']['name']);
$file_name = basename($this->request->files['file']['name']);
$file_ext = array('jpeg', 'jpg', 'gif','png');
$file_size = 3000;
if (is_dir($directory)) {
if (!move_uploaded_file($this->request->files['file']['tmp_name'], $full_path)) {
if (!in_array(utf8_strtolower(utf8_substr(strrchr($file_name, '.'), 1)), $file_ext)) {
$this->error['warning'] = 'Warning: Incorrect file type!';
}
if ($_FILES["file"]["size"] < $file_size) {
$this->error['warning'] = 'Warning: Incorrect file size!';
}
return !$this->error;
}
} else {
$this->error['warning'] = 'Warning: Directory does not exist!';
return !$this->error;
}
}