How can I save a file in PHP to a directory higher than current?
<p>The script is in myusername/public_html/item/index.php</p>

<p>code to save file:</p>

<pre><code>$filename = $_SERVER['DOCUMENT_ROOT'].'/../data/guestbook.txt';
        $filehandle = fopen($filename, 'ab+') or die("&lt;p&gt;Unable to create the file!&lt;/p&gt;\n".$filename);
        flock($filehandle, LOCK_EX) or die("&lt;p&gt;Unable to lock the file!&lt;/p&gt;\n");
        fwrite($filehandle, $new_entry) or die("&lt;p&gt;Unable to write to the file!&lt;/p&gt;\n");
        fclose($filehandle);
</code></pre>

<p>For some reason it fails on the fopen and the filename is actually ends up being literally with the /../ instead of navigating to the proper path. </p>

<p>What to do, what to do?</p>
