<?php
	//$file = "aqwzsx.txt";

	if( isset($_POST['open']) ) 
	  {
	  	$file = $_POST['open'];
	  	
		$fh = fopen($file, 'r') or die('Could not open file!');
		$data = fread($fh, filesize($file)) or die('Could not read file!');
		fclose($fh);
	 }
?>

<table border='0' cellspacing='0' cellpadding='0' width='100%' class='tbl-border'>
<tr>
<td class='tbl2' align='center'><b>Word Program SE v1.0</b>
</td>
</tr>
<tr>
<td class='tbl2' align='left'>



<?php
if (!isset($_GET['open'])) {
?>

<form action="" method="post">
Open File:<input type='file' name='open' enctype='multipart/form-data' class='textbox' style='width:200px;'>

<?php
if( isset($_POST['open']) ) 
  { echo "<input type=\"submit\" name='openfile' value=\"$file\" class='button'>";
  }
else {  
	echo "<input type=\"submit\" name='openfile' value=\"Nom\" class='button'> ";
     }	
?>

</form>

<?php
}
?>

</td>
</tr>
<tr>
<td class='tbl1'>
<center>
<textarea cols='118' name="txtbox" rows='15' class='textbox'><?php echo $data; ?></textarea>
</center>
</td>
</tr>
</table>