Здесь я прилагаю код проблемы желаний. У Cotroller есть следующий код. Контроллер =>
//Load upload library
$this->load->library('upload');
$images = array();
$i = 0;
foreach ($_FILES as $key => $value)
{
$tmp = explode(".",$value['name'][$i]);
$imagename = time().".".end($tmp);
$_FILES['file']['name'] = $imagename;
$_FILES['file']['type'] = $value['type'][$i];
$_FILES['file']['tmp_name'] = $value['tmp_name'][$i];
$_FILES['file']['error'] = $value['error'][$i];
$_FILES['file']['size'] = $value['size'][$i];
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = $imagename;
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('file'))
{
$error = array($i => $this->upload->display_errors());
echo "<pre>";print_r($error);die;
}
else
{
array_push($images,$this->upload->data()['file_name']);
}
$i++;
}
echo "<pre>";print_r($images);die;
Это код формы, который я использую при загрузке файла. Вид =>
<?php $attributes = array(
"class" => "form-horizontal m-t-20",
"method" => "post",
"novalidate" => "",
"enctype" => "multipart/form-data"
);
echo form_open('admin/user/adduser', $attributes); ?>
Вот мой контроль ввода файлов.
<label for="file">Profile Images*</label>
<input type="file" name="files[]" id="file" multiple required placeholder="Profile Images" class="form-control">