今天看啥
热点:

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

 

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

 

 

CodeIgniter文件上传错误:escapeshellarg() has been disabled for security reasons

 

CodeIgniter文件上传错误:escapeshellarg() has been disabled for security reasons

原因:escapeshellarg函数被禁止

解决方法:

1、修改PHP配置文件php.ini,找到 disable_functions 字段,删除 escapeshellarg 。

2、重启php-fpm(nginx环境)。

评论暂时关闭