Peculiar problem with file handling in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

Peculiar problem with file handling in php

Post 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
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

check the capitalisation of your variables...you made a mistake

*HINT* $myfile
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

Post by srirams »

Excellent.
Thanks for pointing that out to me.
That was so silly of me.

Thanks a ton.
Post Reply