This question already has an answer here:
- php check file extension in upload form 10 answers
Currently in my code the extension of the files is checked before it is uploaded to the server. I need to check the content of the files too before uploading it to server. I have used the following code
$FileName = $_FILES[$imageInput]['name']; $finfo = finfo_open(FILEINFO_MIME_TYPE); $mtype = finfo_file($finfo, $FileName);
$mtype is correctly identified for all image type like .png , .jpg but it doesn't recognised .sh files. How can I check this using php? Some one please help.
</div>