-----Original Message----- From: parasane@xxxxxxxxx [mailto:parasane@xxxxxxxxx] On Behalf Of Daniel Brown Sent: Thursday, October 04, 2012 2:56 PM To: jen@xxxxxxxxxxxxxxxx Subject: Re: Programatically create directory On Thu, Oct 4, 2012 at 3:05 PM, Jen Rasmussen <jen@xxxxxxxxxxxxxxxx> wrote: [snip!] > > The issue I am having is that when someone creates an account for > this, I am programmatically creating a folder specific to that user in > an temporary /temp/ and permanent upload /upload/ directory (i.e. 2 > folders). Although I am chmod the folder at the time it is created, it > seems the user cannot upload to the folder. > > The only way I am able to get it to work is if I create the folder > manually via FTP. My research indicates it might have something to do > with the Apache UID or GUID, but being a relative novice with Apache I > am at a loss. I've tried multiple directives via a per directory > htaccess file and nothing seems to work. > > I can, of course, create a number of anticipated folders (based on a > project > id) manually to get around this, but prefer not to do that. > > I could also dump everything into just temp without having it in a > project id folder but I would like to separate content in case of > simultaneous users. > > Additionally, the file upload only seems to work if the folder is > 0777, which I know can have security implications. Advice? I am using plupload. This is a shared Linux server I presume. Correct? It's not Apache-specific, but rather a general permission issue. If you don't have the ability to chown/chgrp the directory to the user as which Apache runs (which should be automatic, since it's the combination of Apache and PHP that is creating the directory in the first place), you'd need to chmod 0777 the target location(s). Are the users only uploading via a web form that's being served by the same Apache server? If so, perhaps the parent directory of the directories you're creating on the fly is owned by your FTP user, which - if you're not using any form of suexec or similar - should differ from the user as which Apache runs (httpd, apache, nobody, www, www-data, psacln, et cetera). In any case, it's not a PHP issue, as you are aware, so it should probably be followed-up on an entry-level Linux forum such as www.linuxquestions.org. And, as you suspect, you're right: if it can be avoided, don't cheat and chmod 0777 $dir. That's so 1997 Perl script README instructions. -- </Daniel P. Brown> Network Infrastructure Manager http://www.php.net/ Yes, it's a shared Linux server, correct. Yes, the users are uploading via a web form served by the same server. Thanks for helping me understand the problem better, I appreciate it! Jen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php