通过 Codeigniter 上传获得 "filetype not allowed"
Getting "filetype not allowed" with Codeigniter upload
首先,关于这个主题已经有很多(已解决的)问题。我尝试了所有可能的解决方案。但无济于事。
- CI 版本
2.1.4
和 2.2.1
都有问题。
- 我也尝试过使用不同的文件类型,例如
png
、gif
和 txt
。
- 我没有做过
mime-type
改动,例如。通过在 .htaccess
文件中使用 AddType
- 我使用了一个简单的 html 表单和一个 Postman 用于调试
- 我已经尝试使用 PHP 版本
5.5
和 5.6
(启用文件信息模块)
- MIME 类型确实存在于
mimes.php
文件中
tmp
文件夹可写
我别无选择...
有人知道问题出在哪里吗?
提前致谢!
配置
$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] =>
首先,关于这个主题已经有很多(已解决的)问题。我尝试了所有可能的解决方案。但无济于事。
- CI 版本
2.1.4
和2.2.1
都有问题。 - 我也尝试过使用不同的文件类型,例如
png
、gif
和txt
。 - 我没有做过
mime-type
改动,例如。通过在.htaccess
文件中使用AddType
- 我使用了一个简单的 html 表单和一个 Postman 用于调试
- 我已经尝试使用 PHP 版本
5.5
和5.6
(启用文件信息模块) - MIME 类型确实存在于
mimes.php
文件中 tmp
文件夹可写
我别无选择...
有人知道问题出在哪里吗?
提前致谢!
配置
$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] =>