Problem with file reading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm a beginner and i'm still learning PHP and I got a problem:


	
	
$file = "http://localhost/test_folder/test1.txt";; //I have also tried "test_folder/test1.txt" and "text1.txt"
	
	
	$fh = fopen($file, "r") or die("Could not open file!");
	
	
	$data = fread($fh, filesize($file)) or die ("Could not read  		 	file!");
	
	
	fclose($fh);
	
	
	echo $data;


The file exist, I'm using apache server on my PC for practicing and the file is located in the servers root folder on the subfolder "test_folder".

Help would be greatly appreaciated

Thanks in advance!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux