SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting file/directories info

    How can I get the permissions of a file or a directory through Php? E.g if I chmod a directory "test" on my server to:
    0777
    How can i get what I just chmoded it to through Php?

  2. #2
    SitePoint Zealot metho's Avatar
    Join Date
    Feb 2005
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fileperms()

  3. #3
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I'm trying to do is:

    - Take a file or directory's Chmod value
    - Chmod the file or directory to 777
    - After some other code, chmod the file back to its original value

    The function fileperms() returns the values such as 33188, 16895, etc instead of 0777 or 0750. Does anybody know of any function which will return its values in a format which I can use in the Chmod function again?

  4. #4
    SitePoint Zealot metho's Avatar
    Join Date
    Feb 2005
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    echo substr(sprintf('%o', fileperms('url')), -4);


Bookmarks

Posting Permissions

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