<? // $dirname is the dir to test.
Function IsWritable($dirname)
{
$fname=md5(rand(1, 100));
if (!$fp=@fopen($path="$dirname/$fname", 'w'))
return false;
else
{
fclose($fp);
unlink($path);
return true;
}
If (IsWriteable($dirname))
{
// do whatever you like...
}
?>