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

前端 未结 10 1614
别跟我提以往
别跟我提以往 2021-01-01 08:07

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

10条回答
  •  悲&欢浪女
    2021-01-01 08:58

    In my case, is_writable returned true, but when tried to write the file - an error was generated.
    This code helps to check if the $dir exists and is writable:

提交回复
热议问题