Results 1 to 2 of 2

Thread: php file problem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    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); 

    ?>

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    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.
    Don't Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width