频道栏目
首页 > 资讯 > CodeIgniter > 正文

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

16-01-08        来源:[db:作者]  
收藏   我要投稿

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

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

相关TAG标签
上一篇:CodeIgniter文件上传错误:escapeshellarg() has been disabled for security reasons
下一篇:二级目录配置CI应用
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站