0

Good Evening everyone,

I am hoping this is the proper place to post this question, might not be but im not really sure where to go with this one. I am working on a website for my company which will be based on our Intranet, and was wondering if there is a way for a page to display file contents.

Example. User runs a report that and comes up with user statistics. (excel document most likely) They would drop the file into /folder/folder/file.xls The website would take the contents of file.xls and display it on the website, this way each day the file is updated, the page will display the new stats.

Any help would be appreciated. Any questions just let me know.

Thanks in advance!

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by almostbob
0

html wont be able to do this but php5+ could.

What you would need to do is to import it into mysql through phpmyadmin. You could then use php to present the data.

0

depends on the complexity of the data, and whether you expect to be able to manipulate it online
If the importand information is a static table of information its a piece of cake
have the script that creates the report output it to a .csv file, with the correct name (same name every day)
a php script to display the datafile as a table

<!-- other html -->
<table border="0" cellpadding="0" cellspacing="1">
<?php $row = 1;
$handle = fopen("dailyreport.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
 $num = count($data);
 $row++;
if ($row == 2) {
 echo "<thead>\n<tr>\n";
  for ($c=0; $c < $num; $c++) 	{  echo "<th >" . $data[$c] . "</th>\n";  }
echo "</tr>\n</thead>\n<tbody>"; 
}
else {
echo "<tr>\n";
for ($c=0; $c < $num; $c++) {
echo "<td>" . $data[$c] . "</td>\n";
}
echo "</tr>\n";
}
}
fclose($handle); ?>
</tbody>
</table>
<!--other html -->

crappy code, but it runs
file upload scripts abound, the script above requires the upload script uploads "dailyreport.csv" to the same folder
security is not considered, but should be in any production version

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.