我正在编写一个脚本来将图像上传到我的应用程序.以下安全步骤是否足以使应用程序从脚本端安全?
这是我的脚本:
$filename=$_FILES['my_files']['name'];
$filetype=$_FILES['my_files']['type'];
$filename = strtolower($filename);
$filetype = strtolower($filetype);
//check if contain php and kill it
$pos = strpos($filename,'php');
if(!($pos === false)) {
die('error');
}
//get the file ext
$file_ext = strrchr($filename, '.');
//check if its allowed or not
$whitelist = array(".jpg",".jpeg",".gif",".png");
if (!(in_array($file_ext, $whitelist))) {
die('not allowed extension,please upload images only');
}
//check upload type
$pos = strpos($filetype,'image');
if($pos === false) {
die('error 1');
}
$imageinfo = getimagesize($_FILES['my_files']['tmp_name']);
if($imageinfo['mime'] != 'image/gif' …Run Code Online (Sandbox Code Playgroud) 有没有办法使用PHP从JPG中删除EXIF数据?我听说过PEL,但我希望有一种更简单的方法.我正在上传将在线显示的图片,并希望删除EXIF数据.
谢谢!
编辑:我没有/不能安装ImageMagick.