Does the script show any problem saying that it cannot write to a directory or file? If it does not, then everything is OK.
If it cannot write to a directory or file and you can only set to 666, then try to do this:
Create empty files with the following names:
Then give chmod 666 to all the files above.
These files can be just plain text files. For example upload myfile.txt and rename to temp1.png, upload myfile.txt and rename to temp1.jpg, and so on…
The above example creates the files for grid 1. If you have a 2nd grid, replace the 1 with a 2, and so on..
More information about file permissions: http://www.elated.com/articles/understanding-permissions/