我是 CodeIgniter 的新手
我已经看过并尝试了一些与此问题类似的答案。但仍然显示相同的错误。
这是我的观点
<?php
echo form_open_multipart('halaman_admin/tambah_gambar');
echo form_upload('userfile');
echo form_submit('upload', 'Upload');
echo form_close();
?>
我的控制器
$config['upload_path'] = './assets/media/gambar/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '5000';
$config['max_width'] = '2024';
$config['max_height'] = '1468';
$this->load->library('upload', $config);
$this->load->helper('form');
$this->load->helper('url');
$this->load->model('admin_model');
$data['pesan'] = '';
if(!$this->upload->do_upload())
{
if(isset($_POST['upload']))
$data['pesan'] = $this->upload->display_errors();
}
else
{
$data['upload_data'] = $this->upload->data();
$data['pesan'] = 'SUKSES';
$config_resize = array(
'source_image' => $data['upload_data']['full_path'],
'new_image' => './assets/media/thumb/',
'maintain_ration' => true,
'width' => 160,
'height' => 120
);
$this->load->library('image_lib', $config_resize);
if(! $this->image_lib->resize())
{
$data['pesan'] = $this->image_lib->display_errors();
}
}
$data['images'] = $this->admin_model->fetch_image(FCPATH.'assets/media/gambar');
$this->load->view('view_admin/upload_gambar_view', $data);
我的模型
function fetch_image($path)
{
$this->load->helper('file');
return get_filenames($path);
}
有什么可以帮助我的吗?
因为我已经尝试了一些关于此错误的发现,它仍然上传错误并显示“您没有选择要上传的文件”。
谢谢你的帮助