I am trying to create .txt files on my server, after given input, but i get the error shown at the bottom.
<?php
$filename = $_GET["firstname"]. " ". $_GET["lastname"].".txt";
$myfile = fopen("$filename", "w") or die("Unable to open file!");
$txt = "Stuur een leuk berichtje naar deze persoon: ". $_GET["emailadres"];
fwrite($myfile, $txt);
fclose($myfile);
?>
I get the error:
Warning: fopen(test.txt): failed to open stream: Permission denied in /home/students/57fasdf6/www/bevestiging.php on line 37 Unable to open file!
Thanks in advance!
Greets,
Rex
The reason why it is throwing that error is, php need to have write permissions on that folder, Try to give it write permissions and try again