Reputation: 1407
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?
Upvotes: 4
Views: 5254
Reputation: 12668
$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."
Upvotes: 14