elis Posted March 31, 2009 Share Posted March 31, 2009 This is a snippet from an upload script I'm using (let me know if I haven't provided enough of the script, please.) <?php $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")) { $wordOnly = "<font color=\"red\"><b>Error message</b></font><p/>"; } else .... ?> Which is for an upload script for users to upload MS Word documents which are then stored. The problem is, it correctly uploads for .doc files (MS Word 97-03) but doesn't work for .docx (MS Word 07+). I'm not familiar with PHP, Mime types, and so forth so forgive any ignorance. Does anyone have any suggestions to fix this? Link to comment https://forums.phpfreaks.com/topic/151968-solved-upload-script-wont-upload-docx-files/ Share on other sites More sharing options...
kenrbnsn Posted March 31, 2009 Share Posted March 31, 2009 When I upload a .docx file this is the mime type: application/vnd.openxmlformats-officedocument.wordprocessingml.document Ken Link to comment https://forums.phpfreaks.com/topic/151968-solved-upload-script-wont-upload-docx-files/#findComment-798046 Share on other sites More sharing options...
elis Posted March 31, 2009 Author Share Posted March 31, 2009 Thank you! Worked perfectly. Link to comment https://forums.phpfreaks.com/topic/151968-solved-upload-script-wont-upload-docx-files/#findComment-798056 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.