This PHP uploads your *.DOC file to a upload folder and opens it up in HTML.
<?php
function content($file){
$data_array = explode(chr(0x0D),fread(fopen($file, "r"), filesize($file)));
$data_text = "";
foreach($data_array as $data_line){
if (strpos($data_line, chr(0x00) !== false)||(strlen($data_line)==0))
{} else {if(chr(0)) {$data_text .= "<br>";
$data_text .= preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/","",$data_line);
}
}
}
return $data_text;}
$destination = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']);
$destination.= "upload/";
$maxsize = 5120000;
if (isset($_GET['upload'])) {
if($_FILES['userfile']['name'] && $_FILES['userfile']['size'] < $maxsize) {
if(move_uploaded_file($_FILES['userfile']['tmp_name'], "$destination/".$_FILES['userfile']['name'])){
$file = $destination."/".$_FILES['userfile']['name'];
$data = content($file);
echo $data;
}
}
}else{
echo "<form enctype='multipart/form-data' method='post' action='index.php?upload'>
<input name='userfile' type='file'>
<input value='Upload' name='submit' type='submit'>
</form>";
}
?>