ho provato a fare così:
Codice PHP:
if (!isset($_POST["text"])) {
echo "Si è verificato un errore";
}else{
$testo = $_POST["text"];
if (!isset($_POST["var"])) {
$filename = "../public/".$_POST['lang']."/".$_POST['lang']."_".time().".txt";
if (!file_exists($filename)) {
$fh = fopen($filename, 'w');
fwrite($fh, stripslashes($testo));
fclose($fh);
}
}else {
$filename = "../public/".$_POST['lang']."/".$_POST["var"];
$fh = fopen($filename, 'w');
fwrite($fh, stripslashes($testo));
fclose($fh);
}
}
mi modifica correttamente il file, ma non mi crea quello nuovo.
mi da errore di
fopen(../public/it/): failed to open stream: Permission denied
fwrite(): supplied argument is not a valid stream resource in