Hi there everyone,
I've tried everything I know to get this to work, but it still eludes me(unfortunately, I don't know much). I've read up on fopen at php.net, and have modified the script to closely match an example on that site, but I still can not write to a file on the server.
Windows
php 4.3.2
Here is my code:
$filename='d:\hosting\bbivins11\admin\index_content.txt';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$fp = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write content to our opened file.
if (fwrite($fp, $_POST['index_content']) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote content to file ($filename). Click <a href='../indextest.php' target='_blank'>here</a> to see your handywork.";
fclose($fp);
} else {
echo "The file $filename is not writable";
}
This nets me:
Cannot open file (d:\hosting\bbivins11\admin\index_content.txt)
so I think it means that it's finding the file, but can't open it.
as a path to the file, I have also tried:
d:\hosting\bbivins11\admin\index_content.txt(read about this at php.net)
http://www.mysite.com/admin/index_content.txt(it can't find the file when I do this)
index_content.txt
fopen is enabled in php.ini
Although I've turned on error reporting via the script, I still don't get any php errors.
Please let me know if I've neglected to include some important information that is needed to help. I'm still learning about php, and I'm not sure exactly what is relevent.
thanks,
json