I have a simple one-field HTML form that submits via a PHP script. The PHP script uses imagejpeg()
to generate a JPG with data submitted with the form. My concern is security. How can I allow that script to run and write the file to the server, but not require the folder permissions to be that anyone can write to the server? If I try to change the directory permissions where the PHP script lives and then writes the image to something more restrictive, I get the following error:
Warning: imagejpeg(covers/b6c8bdf9e441affb6031756f66a379a2.jpg):
failed to open stream: Permission denied in
C:\webroot\share\index.php on line 42