Page 1 of 1

Peculiar problem with file handling in php

Posted: Thu Jun 23, 2005 4:33 am
by srirams
All,

The fread function doesn't seem to work at all. Can someone please help me.

<?
$myFile = "C:\program files\Apache Group\Apache2\htdocs\test.txt";
$fileread = fopen($myfile, "rb");
echo "Reading the file now";
$theData = fgets($fileread);
echo $theData;

?>

Warning message
Reading the file now
Warning: fgets(): supplied argument is not a valid stream resource in C:\program files\Apache Group\Apache2\htdocs\filehandle2.php on line 5

Posted: Thu Jun 23, 2005 4:39 am
by JayBird
check the capitalisation of your variables...you made a mistake

*HINT* $myfile

Posted: Thu Jun 23, 2005 4:49 am
by srirams
Excellent.
Thanks for pointing that out to me.
That was so silly of me.

Thanks a ton.