Verify if the given filename can be written to:
<?php $file = “test.txt”; if(is_writable($file)) { echo (“$file is writable”); } else { echo (“$file is not writable”); } ?> |
The code above might produce is:
test.txt is writable |
The function is_writable() determines if the given filename may be written to.
Note: This function caches its output. To clear the cache, use clearstatcache().
is_writable(file) |
Parameter |
Description |
file |
Essential. gives the location of the file to be checked. |
Return Value: |
If the file can be written to, then TRUE; if not, then E_WARNING |
PHP Version: |
4.0+ |