|
-
Dec 5th, 2005, 06:22 PM
#1
Thread Starter
Frenzied Member
php file problem
i keep getting these errors..
Warning: file_get_contents(test): failed to open stream: No such file or directory in /home/prawgzn/public_html/m/remove.php on line 5
Warning: fopen(test): failed to open stream: Permission denied in /home/prawgzn/public_html/m/remove.php on line 9
Warning: fputs(): supplied argument is not a valid stream resource in /home/prawgzn/public_html/m/remove.php on line 10
Warning: fclose(): supplied argument is not a valid stream resource in /home/prawgzn/public_html/m/remove.php on line 11
with the code..
PHP Code:
<?php
$filename = 'test.txt';
$somecontent = $_GET['data'] . "\n";
$file_data = file_get_contents($filename);
$file_data = str_replace($somecontent, "", $file_data);
$file = fopen($filename, "w");
fputs($file, $file_data);
fclose($file);
?>
-
Dec 5th, 2005, 07:14 PM
#2
PowerPoster
Re: php file problem
You need to make sure that you've chmodded the script, as it needs permission to be able to write to a file.
Secondly, the first line says that it can't find the file, and judging by,
$filename = 'test.txt';
might be why. Try a ./ at the beginning or something like that. Assuming its in the same folder of course.
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
|