TJ111
08-14-2007, 12:43 PM
I am trying to set up a page that allows executives to manipulate the front page of different areas of my website. I set it up and everything worked great locally, however when I uploaded it to the server it turns out the default setting is for "read" permission only. Not a big deal, I went into SSH and ran chmod and changed all permissions to "rw" (proof (http://deltascan.net/example.bmp)). However now the script is returning that the file is not even readable! I've tried restarting apache and everything, but no matter what it tells me the file isn't readable. I don't know what would cause this, but it's been driving me nuts. Here's my scripts to open and read/write the file:
//To write
if (is_writable($page)) {
if (!$handle = fopen($page, "w+")) {
echo "<h3 class='error'>Error Opening File for Saving</h3>";
exit;
}
if (fwrite($handle, $introContent) === FALSE) {
echo "<h3 class='error'>Cannot write to file</h3>";
exit;
}
fclose($handle);
echo "<h3>File Saved</h3>";
}
else {
echo "<h3>File not Writables!</h3>";
}
//And to read it
if (is_readable($page)) {
if (!$handle = fopen($page, "r")) {
echo "<h3 class='error'>Error Opening File</h3>";
exit;
}
$contents = fread($handle, filesize($page));
fclose($handle);
echo $contents;
}
else {
echo "<h3>File not Readable!</h3>";
}
//To write
if (is_writable($page)) {
if (!$handle = fopen($page, "w+")) {
echo "<h3 class='error'>Error Opening File for Saving</h3>";
exit;
}
if (fwrite($handle, $introContent) === FALSE) {
echo "<h3 class='error'>Cannot write to file</h3>";
exit;
}
fclose($handle);
echo "<h3>File Saved</h3>";
}
else {
echo "<h3>File not Writables!</h3>";
}
//And to read it
if (is_readable($page)) {
if (!$handle = fopen($page, "r")) {
echo "<h3 class='error'>Error Opening File</h3>";
exit;
}
$contents = fread($handle, filesize($page));
fclose($handle);
echo $contents;
}
else {
echo "<h3>File not Readable!</h3>";
}