Member Avatar


I'm trying to open a file from my OS (Window 7) from my web host server. But it can't load the files. I try fget() but it seems like it's not reading it?

header("Cache-control: private");
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/link.css" type="text/css" rel="stylesheet">

<? include("header.php");?>

if (!file_exists($filename)){ // Check for file existence
print "No such file or directory";
 $fh=fopen($filename,"r"); // Open the file for reading
while( !feof($fh)){
$line_of_text=fgets($fh); // Get text line from the
print "$line_of_text";
fclose($fh); // Close the file

<? include("footer.php");?>

Member Avatar

On line 18 change to $filename = $_SERVER[DOCUMENT_ROOT] . "/filelinks/data.file";

Hope it works ;)

commented: I appreciate that you took the time help me! +2
Member Avatar


Thanks for the reply! You put a period. I will try to change it now.

Member Avatar


It works! I appreciate that you took the time help me. Thanks.