Using PHP to upload files: "application/msword" is not reading .docx?

Spaghetti Cat

New member
I have this snippet:

$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp = fopen($tmpName, 'r');
$content = fread($fp, $fileSize);
fclose($fp);
if($fileType != ("application/msword"))

Which is supposed to only allow users to upload MS Word files. However, it's only allowing 97-03 files (.doc) and not .docx file.
Could someone please suggest how I could fix this so that docx files may also be uploaded?
Got it work:
I used "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

for the Mime type.
Thank you for the help.
 
Back
Top