Jump to content


Photo

fopen with w+ string mode error


  • Please log in to reply
1 reply to this topic

#1 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 28 September 2006 - 07:53 AM

I get the error message below when i try to run the follow code. can anybody tell me where did i do wrong. I am running PHP 5.1.2 on IIS 5.5 (Windows XP)

$filename = "textfile.txt";
$fp = fopen($filename, "w+");
$somecontent =  "Hello World";
fwrite($fp, $somecontent);
fclose($fp);

PHP Warning: fopen(textfile.txt) [function.fopen]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\PHProg\testfile.php on line 10 PHP Warning: fwrite(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\PHProg\testfile.php on line 12 PHP Warning: fclose(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\PHProg\testfile.php on line 13
Thanks for the help & support given by all.

#2 mjlogan

mjlogan
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 28 September 2006 - 09:06 AM

Make sure you set the right permissions for the file. It's basically a access denied error, so the permissions are not correct.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users