在上传之前有没有办法检查文件,它有病毒吗?
我的代码上传是: -
function uploadfile()
{
$allowedExtensions = array("jpg","jpeg","gif","png","doc","pdf","ppt","zip","rar","xls","pptx","docx","xlsx");
$split=explode(".",$_FILES["filework"]["name"]);
$type=strtolower($split[sizeof($split)-1]);
$rname=time().".".$type;
if (in_array(end($split),$allowedExtensions)) {
$destination = "uploads/".$rname;
$temp_file = $_FILES['filework']['tmp_name'];
move_uploaded_file($temp_file,$destination);
return $rname;
}
else {return false;}
}
答案 0 :(得分:6)
不,必须先将文件上传到您的服务器,然后再进行扫描。如果您还没有该文件,您如何扫描它?