我的上传页面出现问题。当我尝试上传文件时,可以通过“所有类型”设置的扩展名,但我试图将我允许的类型配置设置为jpg。这是我的控制者:
public function upload_file($noArsip)
{
$config['upload_path'] = './assets/img/arsip/';
$config['allowed_types'] = 'jpg'; // --> how to make the allowed type only image extension?
$this->load->library('upload', $config);
$this->upload->do_upload('video');
$data_upload_files = $this->upload->data();
//proses database
$image = $data_upload_files['file_name'];
$data = array(
'video'=>$image
);
$this->daftar_arsip_m->updateData($noArsip,$data);
//$this->load->view("upload_foto_v", $data);
redirect('upload_foto');
}
我不想在选择文件时使用验证,我只是希望它过滤相关扩展名的文件,如图像或视频相关类型。谢谢你的帮助