我在codeigniter中上传CSV文件时遇到问题。
我收到错误:
array(1) { ["error"] => string(64) "The filetype you are attempting to upload is not allowed." }
行!
但是我设置了这样的allowed_types:
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'csv';
$this->load->library('upload', $config);
我在mimes.php中有这个:
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
所以任何想法为什么我仍然会收到此错误?
$ _ FILES转储:
Array
(
[name] => default questions.csv
[type] => application/force-download
[tmp_name] => /tmp/phpbkXxUd
[error] => 0
[size] => 5899
)
答案 0 :(得分:0)
试试这个
$ config [' allowed_types'] =' *';
这应该有效 。还要检查你的upload.php或mimes.php。使用最新的。