php框架

 首页 > php框架 > CodeIgniter文件上传错误:the filetype you are attempting to upload

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

分享到:
【字体:
导读:
         [导读] 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);

 

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

分享到:
二级目录配置CI应用
一般情况下,我们都是把项目配置在网站根目录下,如果把项目配置在网站二级目录下,那么这时该怎么配置CI呢? 如,网站域名为 www.domain.com,在网站根目录下建立二级目录 test ,在这个test目录下配置应用,我们访问的域名为 www.domain.com/test,为了项目可以通过该URL进行正常访问,需要对服务器进行相应配置: ...
CodeIgniter文件上传错误:escapeshellar...
CodeIgniter文件上传错误:escapeshellarg() has been disabled for security reasons 原因:escapeshellarg函数被禁止 解决方法: 1、修改PHP配置文件php.ini,找到 disable_functions 字段,删除 escapeshellarg 。 2、重启php-fpm(nginx环境)。
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……