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 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    5
    Thanked 0 Times in 0 Posts

    new folder permissions

    i have recently uploaded my site onto a webserver, the site requires users to upload mp3 tracks and then streams the tracks using flash. When a user registers a new folder is created to the server to store the mp3s and assigned the same name as the user. The problem is that the folder does not have the correct permissons and so the flash app cannot read the folder. If i manually alter the folders permissons to allow all, it works. is there a way to do this with php? At the moment i am using:

    mkdir($d, 0777);

    thanks

  • #2
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    Try using this :

    PHP Code:
    $oldumask umask(0);
    mkdir($d0766);
    umask($oldumask); 

  • Users who have thanked Killermud for this post:

    maroccano1 (05-03-2009)

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    5
    Thanked 0 Times in 0 Posts
    that didn't seem to work but when i tried:

    $oldumask = umask(0);
    mkdir($d, 0777);
    umask($oldumask);

    it Worked! i don't why but it did. What does the mask do?

  • #4
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    Oh right its because I had the permissions as 766 not 777.

    the umask function sets PHP's umask to mask & 0777 and returns the old umask.

  • #5
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    5
    Thanked 0 Times in 0 Posts
    cool, thanks alot.


  •  

    Posting Permissions

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