I have the following code to check if (resume and reference letter uploaded match desired type (pdf OR doc OR docx) and size (less than 400 kb)
//check file
To do that I usually using something like that:
$filename = $_FILES['field_name']['name']; // Get the name of the file (including file extension).
$ext = strtolower(substr($filename, strpos($filename,'.'), strlen($filename)-1)); //get the extention in lower case
And than check if the file extension is accepted.
Also be aware that that the user can simply change the extension for a dangerous file, so it is safer to check with the mime type