Hey Guys,
Here is some code that I have been working on and I can not seem to get it right...I am learning how to write to a file....Pretty awesome...I understand how it works, but I need to know if I can run my script in this location ( home/folderA ) and edit a text file in this location ( home/folderB ).....I know the file is being read, but the file will not change or update.
// Checking our file
$file = "../soda.txt";
// does the file exist?
if(file_exists($file))
{
// is it readable?
if(is_readable($file))
{
echo $file." is readable! <br/>";
}
// is it writable?
if(is_writable($file))
{
echo $file." is writable! <br/>";
$fh = fopen($file, 'w') or die("can't open file");
$stringData = "$htpasswd_text";
fwrite($fh, $stringData);
fclose($fh);
}
}
// file does not exist
else {
echo("The File Does Not Exist");
}
echo "<p><hr></p>";
echo "Your file has been updated!";
echo "<p><hr></p>";
Can you guys take a look and tell me why I can't write to the file....
Thanks