How do I check if a directory is writeable in PHP?

SeanDowney picture SeanDowney · Sep 20, 2008 · Viewed 74.6k times · Source

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 does work. See the accepted answer.

Answer

DGM picture DGM · Sep 20, 2008

Yes, it does work for 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.