我的代码有问题,我尝试上传 csv 文件,几天前它还在工作,但是当我今天早上再试一次时。它不起作用。错误提示“不允许您尝试上传的文件类型。”。
好吧,我使用 codeigniter 和 csvimport 作为库。不知道有没有这个效果。有关其他信息,几天前我在尝试第二次上传之前更新了 wamp 服务器。
我的控制器代码:
public function tambahsoal(){
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'csv';
$config['max_size'] = 1000;
$this->load->library('upload',$config);
$this->upload->initialize($config);
if(!$this->upload->do_upload()){
$data['error'] = $this->upload->display_errors();
$this->load->view('dosen/hasilup',$data);
}else{
$file_data=$this->upload->data();
$file_path='./upload/'.$file_data['file_name'];
//bla bla i code again for get everthing in my csv file.
}
}
结果将处于 if 条件。“您尝试上传的文件类型不被允许。”
谢谢。