Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHP Magazine:
Finding File Permissions
Dec 11, 2003 @ 13:20:04

From PHP Magazine this morning: If you have been wondering how to use PHP to view the file permission, then the threads to a post on php-general may just provide the answers. Here's what the post seeked to find: The chmod() function for PHP is nice but it wouldn't work if the ownership file permission is set. How does one view the file/folder permission to see if it has the neccessary permission before proceeding.

Thankfully, like most things in PHP, there's already a built-in function for everything - and this is no exception. The fileperms() function.

Use fileperms to get file permissions. For more description see here. If you have a file permission as "-rw-r--r--" or "644" and when using the fileperms() function,it spitted a result as "33188", apply 33188 (base 10) == 0x100644 (base 8). Further, to convert to base 8, use base_convert().

tagged:

Link:


Trending Topics: