0

Are there any way to check the file befor upload it, it have virus or not ??

My code upload is :-

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

}

1 Answers1

8

No, the file must be uploaded to your server before you can scan it. If you don't have the file yet, how can you scan it?

Brad
  • 159,648
  • 54
  • 349
  • 530