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
This may be useful:
First check desired mime types to verify:
Microsoft Office MIME Types and List of MIME Types
Then try make your code easier...
$mimeTypes = array('application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.presentationml.presentation');
if (in_array($_FILES["resume"]["type"], $mimeTypes))
{
// File's OK
}
else
{
// Bad file !
}
Important: User may change file extension, so always check the mime type intead of extension!! =)