All,
I get the following message:
Warning: fread(): supplied argument is not a valid stream resource in C:\program files\Apache Group\Apache2\htdocs\filehandle2.php on line 4
Warning: fclose(): supplied argument is not a valid stream resource in C:\program files\Apache Group\Apache2\htdocs\filehandle2.php on line 5
The code is
<?
$myFile = "test.txt";
$fh = fopen($myfile, 'r');
$theData = fread($fh,3);
fclose($fh);
?>
I have verified that the file test.txt exists and has some text in that. But I don't know why the above error message is appearing.
Could someone else.
File operations problem
Moderator: General Moderators
Re: File operations problem
Remember case sensitivity of the variable names
Code: Select all
$myFile = "test.txt";// note F
$fh = fopen($myfile, 'r'); // note f
$theData = fread($fh,3);
fclose($fh);