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?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.