SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to check file permission ?

    hello

    how to check file permission using php ? I know php chmod() can set right permission
    but how to know current permission of a file ?

    Thank you!

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure about getting file permission. So i also curious to know about it if any function or way in PHP.

    Since you can add/set new permission to file/directory according to your requirements, why do you wanna get/know file permission?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    infact I am using is_writeable , but as is seems there is no php command to know permission for a file.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    There's a function for this

    http://uk3.php.net/manual/en/function.fileperms.php

    fileperms
    (PHP 4, PHP 5)

    fileperms Gets file permissions

    Description
    int fileperms ( string $filename )

    Gets permissions for the given file.

    Parameters

    filename
    Path to the file.


    Return Values
    Returns the permissions on the file, or FALSE in case of an error.


    Hope this helps

    Andrew

  5. #5
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrewtayloruk View Post
    http://uk3.php.net/manual/en/function.fileperms.php
    fileperms
    (PHP 4, PHP 5)
    fileperms Gets file permissions
    Description
    int fileperms ( string $filename )
    Gets permissions for the given file.
    Parameters
    filename
    Path to the file.
    Return Values
    Returns the permissions on the file, or FALSE in case of an error.
    Hope this helps
    Andrew
    Thank you Andrew. I haven't that function and never tried to look for though because if i can directly set the permissions then i did not look for that.

    Thank you once again. Lol!
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  6. #6
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thank you!


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
  •