I have developed a small web app.
This app allows users to upload images. It also produces text files with the names of those images (the names are stored and retrieved to/from an MySQL Database.)
I have developed this app using MAMP. To create the uploaded image files I use the PHP function
imagejpeg('my/path/name.jpg')
and to delete the files I use the PHP function
unlink('folder1/folder2/name.jpg')
to write to the text document I am using the function
fopen('folder1/folder2/name.txt', 'w')
all three of these functions produce errors related to permissions - now the site has been moved to a live hosting environment.
Why is this? and what permissions do I need to set the folder's folder1
and folder2
to?
I know that permission 777 is generally bad because it opens up your server to the public. However what I have found is that the functions fail to work unless I use 777 on the folders. Can anyone shed any light on my dilemma?