Hiya
I'm having issues getting a php form to write to a file hosted with the apache httpsdocs folder. The form works just fine if all parts of it are using the http protocol, but when I secure the form, form submission and the file the results are written to, it fails.
Can anyone help?
This is the php code:
$myFile = "files/data.txt";
$fh = fopen($myFile, 'a') or die ("Could not read file");
$stringData = "Data in pipe format\n";
fwrite($fh, $stringData);
fclose($fh);
header( 'Location: http://www.example.com/thankyou');
And the various LOCATIONS are:
- /var/www/vhosts/example.com/httpdocs/files
- /var/www/vhosts/example.com/httpsdocs/files
Additionally, my form page is https://example.com/form.php, and the form field redirects to action="processform.php", so why does it look for processform.php in httpdocs rather than httpsdocs? Surely it should stay within the same protocol/directory as it was called from!
Thanks for any help :)