...

View Full Version : view document file into html format



che_anj
08-03-2007, 03:34 PM
Hello i get this example code and I try but it doesnt work. could anyone pls help me what to do with this..
This is to view the document file into html format..

<?php
$PathToDocumentFolder = '/var/www/web23/web/main/cvs/';
?>
<html>
<head>
<basefont face="Arial">
<title>My Documents</title>
</head>
<body>
<h2>My Documents</h2>
<table border="2" cellpadding="5" cellspacing="1" width="90%">
<tr>
<th>Name</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<?php
$dHandle = dir($PathToDocumentFolder);
while($dContent=$dHandle->read())
{
if(substr($dContent,-4)== ".doc")
{
?>
<tr>
<td width="55%" align="left"><?php echo $dContent;
?></td>
<td width="20%" align="center"><a href="<?php echo
$PathToDocumentFolder." ".$dContent; ?>">View as Word</a></td>
<td width="20%" align="center"><a href="<?php echo
"htmlviewer.php?DocumentPath=".$PathToDocumentFolder." ".$dContent;
?>">View as HTML</a></td>
</tr>
<?php
}
}
// close the handle to the directory
$dHandle->close();
?>
</table>
</body>
</html>


this is the link http://testserver.indigo21.com/mydesign/views.php
tnx

rafiki
08-04-2007, 11:32 AM
you have a space in the filenames which sends a 404 for word doc and the path couldnt be found by php


<a href="<?php echo
'htmlviewer.php?DocumentPath='.$PathToDocumentFolder.''.$dContent;
?>">View as HTML</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum