网站地图    收藏   

主页 > 后端 > codeigniter >

CodeIgniter文件上传错误:the filetype you are attempting to upload

来源:未知    时间:2015-04-22 09:59 作者:xxadmin 阅读:

[导读] CodeIgniter文件上传错误:the filetype you are attempting to upload is not allowed 在本地lnmp测试环境文件上传成功,代码移至到生成环境后,提示the filetype you are attempting to upload is not allowed 错误,谷...

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);

 

通过把允许上传类型改为 * ,这样可能会存在一些安全问题。 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论