I've searched for this but I can't seem to find a real answer.
I'm writing some simple CMS-type scripting where a user will occasionally upload an image to a certain directory. If the user thinks the image looks OK, the script copies it from a temporary location to an image directory.
Everything works fine, except that the script, as I have it up to now, seems to require that the image directory in question has its permissions set to 777. Otherwise the file won't copy. But leaving a directory set at 777 is asking for trouble, as far as I can understand (though I don't fully understand why).
I've tried just using: chmod($TheImageDirectory, 0777) but that doesn't work.
Due to the way my hosted Linux server is set up, I can't put the images in a non-public directory. It's running PHP version 4.3.11, with safe_mode off.
I tried using ftp_site (as per example 1 at the manual link), but this didn't work ("command failed"). Is this because there's a period (.) in my server path? Oh heck.
So I'm at a loss to think of any way to set the directory's permissions in the script 'on the fly' as it were (like: to 777, [image is copied], then reset to 751). Is there a way? :bemused: