|
-
Nov 11th, 2006, 12:41 AM
#1
Thread Starter
Hyperactive Member
File Operation
Hi,
Please tell me what's wrong with the following snippet of code.
[phpcode]
<?php
$total=100;
$a=fopen("Thankyou.txt","w");
fwrite($a,$total);
fclose($a);
?>
[/phpcode]
I have got the following error messages:
Warning: fopen(Thankyou.txt): failed to open stream: Permission denied in /home/amitnet/public_html/test.php on line 4
Warning: fwrite(): supplied argument is not a valid stream resource in /home/amitnet/public_html/test.php on line 5
Warning: fclose(): supplied argument is not a valid stream resource in /home/amitnet/public_html/test.php on line 6
Please help.
Thank you very much for help in advance.
-
Nov 11th, 2006, 01:26 AM
#2
Re: File Operation
make sure you have write permissions to the file Thankyou.txt. I assume you have shared webhosting on a *nix server.. so, just FTP into your server and right click on your Thankyou.txt file, and chmod it so that you have write permissions. If you don't know how, with most FTP clients you can right click on a file and either go to "Properties" or something that says permissions, CHMOD, or anything similar.. most FTP clients then ust give you 9 checkboxes, 3 for read, 3 for write, and 3 for execute. since your text file is not executable, you can leave the execute ones blank. you can check the 3 read and 3 write ones.
this should rectify your problems.
-
Nov 16th, 2006, 04:13 AM
#3
Thread Starter
Hyperactive Member
Re: File Operation
Thank you for your help.
Please tell me how to set file attributes from php code.
-
Nov 16th, 2006, 04:45 AM
#4
Re: File Operation
You can't. Not from PHP. You must do it from the FTP client.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|