Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic Folder permission problems

    I'm setting up a light CMS for a client that creates new folders/directories when she adds a subsection to her site. On a seperate page, she can add images that are placed inside of these directories and I'm able to do that with existing directories, but not the ones created dynamically. I'm using the following code to create the directory:

    Code:
    mkdir("../portfolios/$subname", 0777)
    Which creates the folder successfully, but the permissions are off when I check them out and I'm unable to copy files to it. Is this a server setting? Or has anyone run into anything like this? Thanks for any help...

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There are a couple of things you could try. Firstly it could be the umask of the server throwing things off. Try doing this:
    PHP Code:
    $original_umask umask(0); 
    mkdir("../portfolios/$subname"0777);
    umask($original_umask); 
    If that doesn't work, you might consider using PHP's ftp functions to actually create the directory as if you were a normal ftp user, or to chmod the directory just like an ftp user - that should solve the permission problems but the first resolution is preferable since it's much simpler.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •