通过 Codeigniter 上传获得 "filetype not allowed"

Getting "filetype not allowed" with Codeigniter upload

首先,关于这个主题已经有很多(已解决的)问题。我尝试了所有可能的解决方案。但无济于事。

我别无选择...
有人知道问题出在哪里吗?

提前致谢!


配置

$this->uploadconfig =  array(
    'upload_path'     => "./tmp/",
    'allowed_types'   => "png|gif|txt",
    'overwrite'       => TRUE,
    'max_size'        => "25000KB",
    'max_height'      => "5000",
    'max_width'       => "5000"
);
$this->load->library('upload', $this->uploadconfig);

错误

The filetype you are attempting to upload is not allowed.

输出

[file_name] => test.png
[file_type] => image/png
[file_path] => /CORRECT_SERVER_PATH/tmp/
[full_path] => /CORRECT_SERVER_PATH/tmp/test.png
[raw_name] => test
[orig_name] => 
[client_name] => test.png
[file_ext] => .png
[file_size] => 851
[is_image] => 1
[image_width] => 
[image_height] => 
[image_type] => 
[image_size_str] => 

我找到了解决方案:

Codeigniter 2.1.4 有一个错误 here
所以我已经将 CI 更新到版本 2.2.1,遵循更新说明 here and here

第二次检查 mimes.php 文件后,我注意到原始文件与新版本中包含的文件之间存在 差异。我把旧的换成新的,问题就解决了。

升级说明中没有记录,事实上这两个文件之间存在差异。文件的较旧 (CI 2.1.4) return 是一个数组。较新的(CI 2.2.1)没有return一个数组,而是设置一个变量名为$mimes.

的数组