将上传图像传递给Codeigniter 3安全功能

时间:2016-02-23 15:30:08

标签: php codeigniter-3

我想在Codeigniter 3的控制器中使用此安全功能,以便在uploads文件夹中上传图片。

if ($this->security->xss_clean($_FILES, TRUE) === FALSE){
     // file failed the XSS test
    header('HTTP/1.0 403 Forbidden');
    die('The file you requested is not an image.');
}else{
   //the file is an image we can go on
}

我已将某些pdf文件扩展名更改为.jpg,当我上传假图像时,脚本不会停止执行。

所以我试图传递$ _FILES,$ _FILES ['userFile'],$ _FILES ['userFile'] ['tmp_name'],但所有结果都相同。

我的问题是,这是我必须传递给这个安全功能的正确参数吗?

任何帮助将不胜感激。

0 个答案:

没有答案