CodeIgniter文件上传错误:the filetype you are attempting to upload is not allowed
在本地lnmp测试环境文件上传成功,代码移至到生成环境后,提示 the filetype you are attempting to upload is not allowed 错误,谷歌了N久才找到解决方法。
网络上有说出现 the filetype you are attempting to upload is not allowed 错误的可能原因:
1、重命名导致,去除重命名配置项
2、重名不带后缀
.....
最终解决方法:
修改前:
$config['allowed_types'] = 'jpg|gif|png|jpeg|bmp';修改后:
$config['allowed_types'] = '*';最终上传配置项:
$config['upload_path'] = $save_path;$config['allowed_types'] = '*';$config['file_name'] = "{$userid}.png";$config['overwrite'] = true;$this->load->library('upload', $config);
通过把允许上传类型改为 * ,这样可能会存在一些安全问题。