Debian Codegraph @

qchem/read.php

raw
1 <?php
2 // Simple PHP script to read the contents
3 // of a file and return to webpage via AJAX.
4 //
5 // Requires filename including full relative path
6 //
7
8 //echo "Using PHP to read file.\n";
9
10 // Assign parameters to local variables
11 $filename = $_POST['filename'];
12 echo "Filename = [" . $filename . "]\n";
13
14 // Open file and return raw contents to user
15 $fh = fopen($filename,'r') or die("Unable to open file $filename");
16 while ( !feof($fh)) {
17 echo fgets($fh);
18 }
19 fclose($fh);
20
21 ?>