Jump to content

[SOLVED] Upload script: won't upload .docx files


elis

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.