this is how i do it:
create a file with file_put_contents() and check the return value, if it is positive (the number of bytes written), then you can go and do what you need to do, if it is FALSE, then it is not writable
$is_writable = file_put_contents('directory/dummy.txt', "hello"); if ($is_writable > 0) echo "yes directory it is writable"; else echo "NO directory it is not writable";
then you can delete the dummy file using the unlink () function
unlink('directory/dummy.txt');
Nassim Jun 16 '15 at 12:11 2015-06-16 12:11
source share