2am dumb question, Finding a location out of root
Posted: Fri Jan 13, 2006 1:23 am
hello.. i know this is extremely dumb question... but using a Reactor type server on my home network, how do i point to / add lines to a file out side of the "root"??
Code: Select all
$filename = 'C:\Program Files\Sony\EverQuest II\logseq2.txt';
$somecontent = "Add this to the file\n";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}