So I would like it so that a user can input something into a textbox, type a name for the file, and the file is saved in a subdirectory marked content. For example, if I picked the name of the file to be test.txt, I want the file to be saved in content/test.txt. I can't figure out how to save the file in that directory without putting the script in that directory.
What I have:
[PHP]$filename = $_POST['title'];
$text = $_POST['content'];
$fp = fopen ($filename, "w");
if ($fp) {
fwrite ($fp, $text);
fclose ($fp);
echo ("Content Added.");
}
else {
echo ("Error.");
}[/PHP]
What I have:
[PHP]$filename = $_POST['title'];
$text = $_POST['content'];
$fp = fopen ($filename, "w");
if ($fp) {
fwrite ($fp, $text);
fclose ($fp);
echo ("Content Added.");
}
else {
echo ("Error.");
}[/PHP]
Comment