Jump to content

[PHP5] File io


Drezard

Recommended Posts

Hello,

 

Im trying to use an fopen command to read a .txt file but its throwing errors. The log.txt file is in the exact same directory as the script but its throwing these errors:

 

Warning: fopen(C:\www\log.txt) [function.fopen]: failed to open stream: No such file or directory in C:\www\rainbow.php on line 3

 

Warning: fread(): supplied argument is not a valid stream resource in C:\www\rainbow.php on line 5

 

Warning: fclose(): supplied argument is not a valid stream resource in C:\www\rainbow.php on line

 

Code:

<?php

$fileh = fopen("log.txt", "r+");

$contents = fread($fileh, 1024);

echo $contents;

fclose($fileh);

?>

 

Please help because im sure I wrote all the correct code!

 

Daniel

Link to comment
https://forums.phpfreaks.com/topic/121996-php5-file-io/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.