Does anyone know how I can check to see if a directory is writeable in PHP?
The function is_writable doesn\'t work for folders.
Edit: It doe
You may be sending a complete file path to the is_writable()
function. is_writable()
will return false if the file doesn't already exist in the directory. You need to check the directory itself with the filename removed, if this is the case. If you do that, is_writable
will correctly tell you whether the directory is writable or not. If $file
contains your file path do this:
$file_directory = dirname($file);
Then use is_writable($file_directory)
to determine if the folder is writable.
I hope this helps someone.