Re: is_writable for a dir?
| From: | Michael Sims | Date: | Sat, 22 Feb 2003 15:16:27 +0000 |
| Subject: | Re: is_writable for a dir? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136633@lists.php.net to get a copy of this message | ||
On Sat, 22 Feb 2003 07:23:20 -0500, you wrote:
>Hi, all --
>
>How can I tell if a directory is writable? It seems that is_writable
>only works on file, and the mode I get out of stat() is [in this case,
>anyway] '16895' for a 0777 dir.
The 16895 is in decimal. Use decoct() to convert it to octal and drop
the leading digit (which seems to be 4 for directories):
$statInfo = stat('./testDir');
$dirMode = substr(decoct($statInfo['mode']), 1);