我们得到一个错误您尝试上传的文件类型是不允许的笨版本3.0.4
错误:
Error: The filetype you are attempting to upload is not allowed.
array(1) { ["csv"]=> array(5) { ["name"]=> string(18) "cod_sp_payment.csv" ["type"]=> string(24) "application/vnd.ms-excel" ["tmp_name"]=> string(24) "C:\xampp\tmp\php5910.tmp" ["error"]=> int(0) ["size"]=> int(155) } }
控制器代码:
$config['upload_path'] = './uploads/excel/';
$config['allowed_types'] = 'text/comma-separated-values|application/csv|application/excel|application/vnd.ms-excel|application/vnd.msexcel|text/anytext|text/plain|text/csv|csv';
$this->load->library('upload', $config);
if(! $this->upload->do_upload('csv')) {
$error = array('error' => $this->upload->display_errors());
// $this->load->view('upload_form', $error);
echo $this->upload->display_errors();
}
$upload_data = $this->upload->data();
exit();
@AnuAbraham但很难在代码中留下评论,你可以通过点击标签下方的编辑按钮来更新你的问题。 – user4419336
@ Arun我们已经按照您的建议更改了我们的代码。请检查上面的代码 –