How To Get File Permission In Php Getting Files Permission



How To Get File Permission In Php Getting Files Permission
How To Get File Permission In Php Getting Files Permission
Post Description:
Post Tags: how, to, get, file, permission, in, php, getting, files, permission
This Post Has Been Viewed 210 Times Since Sat Mar 01, 2008 1:35 pm Posted By hostman with 1 replies
How To Get File Permission In Php Getting Files Permission
today i wanted to know how i get a file's permission through php script, well you can do it

you can do this:

<?php
echo substr(sprintf('%o', fileperms('/directory')), -4);
echo substr(sprintf('%o', fileperms('/directory/subdirectory')), -4);
?>


OUTPUT
1777
0644


with this, you can verify or show what are the permissions for a certain file in php in your directories from your website.

Leave Your Comments     [ dejar commentarios ]
  * Name     [nombre]

  * eMail (will not be published)     [coreo electronico]

* Enter Your Reply or Comments:    [commentarios]


Add Picture To Comments         [incluir foto]
YES NO             upload
Receive Replies on my Comments (An email will be sent to you when someone replies to your comments)

     

Comments and replies About How To Get File Permission In Php Getting Files Permission




:: 1 :: #43784 - Reply By hostman On Sat Mar 01, 2008 1:44 pm
you can also use is_writeable() function;

more at:

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