루트 디렉토리를 만들고 경로를 설정 했으므로 프런트 엔드를 그대로 사용했습니다. ide는 어떤 오류도주지 않고 있지만 진행할 때 어떤 이미지도 선택하지 않았다고 말합니다.codeigniter에서 파일 업로드가되지 않습니다. 오류 : 파일을 선택하지 않았습니다.
컨트롤러 코드 :
class Images extends MY_Controller
{
function __construct()
{
parent::__construct();
}
function index()
{
$this->data['displayname'] = $this->admin->lastname;
$this->data['images'] = Image::all();
$this->data['btn'] = 'Save';
$this->data['content'] = 'admin/images/index';
$this->load->view('layouts/admin', $this->data);
}
public function do_upload() {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = '*';
//$config['max_size'] = 100;
//$config['max_width'] = 1024;
//$config['max_height'] = 768;
$this->load->library('upload', $config);
if (! $this->upload->do_upload('images'))
{
$error = array('error' => $this->upload->display_errors());
// echo $this->upload->display_errors();
$this->load->view('index', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
뷰 코드 : 이것은 당신이
<?php form_open_multipart('admin/images/do_upload') ?>
하지 않음이를 사용해야 파일 업로드의 경우 파일
<?= form_open('admin/images/do_upload') ?>
<label><?= form_upload('images[]')?></label>
<div class="input-group-btn">
<button class="btn btn-success add-image" type="button"><i class="glyphicon glyphicon-plus"></i> Add</button>
</div>
</div>
</ul>
<div class="line"></div>
<?= form_submit('', 'Submit', 'class="publish-btn"') ?>
<?= form_close()?>
이 시간 – user4419336