Hello everyone. I am new to the forum and have a quick question.

Hope someone can help. I am sure someone has asked this before, please point me in the right direction.

I am using php through my school. So i do not have access to permissions and stuff like that so please keep that in mind.

fwrite(): supplied argument is not a valid stream resource
fclose(): supplied argument is not a valid stream resource

what can i do about this and what is it telling me.

Thanks in advance
- Paranormalcy

    <?php

    $postnum = $POST['postnum'];
    $mrid = $
    POST['mrid'];
    $postperc = $POST['postperc'];
    $launchdate = $
    POST['launchdate'];

    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];

    ?>

    <html>
    <body>

    <?php

    $outputstring = $mrid."\t"."\t"."\t".$launchdate."\n"."\n"."\n"."Posted \t\t".$postnum."\t"."\t"."\t".$postperc."\n";

    @ $fp = fopen("$DOCUMENT_ROOT/../folder/text.txt", 'a+');

    if (!@fp)
    {
    echo '<p><strong>There was an error, Please try again</strong></p>';

    exit;
    }

    fwrite($fp, $outputstring, strlen($outputstring));
    fclose($fp);

    echo '<p>Added Successfully</p>';

    ?>


    I have this on my ftp site which is essentially running apache and php.

    file path is ~/public_html/folder/text.txt

    am i referencing the text file correctly?

      first, take the @ off of the line @$fp = fopen("$DOCUMENT_ROOT/../folder/text.txt", 'a+');

      the @ supresses errors. so I am guessing that your fopen is failing.

        Write a Reply...