I'm writing a WordPress plugin that requires manipulating files in the plugin directory, and I can't figure out how to diagrammatically determine whether PHP has write permissions to a folder. How would I go about achieving this in a relatively simple manner?
$b = is_writable( "/file/or/folder/to/test" ); //boolean value
http://php.net/manual/en/function.is-writable.php
Works on files as well as on folders: "Returns TRUE if the filename exists and is writable. The filename argument may be a directory name allowing you to check if a directory is writable."
fileperms gets permissions for the given file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With