私は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);
}
私を助けることができるものはありますか?
このエラーについていくつか試してみましたが、それでもアップロード エラーが発生し、「アップロードするファイルが選択されていません」と表示されます。
ご協力いただきありがとうございます