PHP/File Directory/is readable
is_readable
<source lang="html4strict">
<?php $file_name="permissions.php"; if(is_readable($file_name)) {
echo ("The file $file_name is readable.
");
} else {
echo ("The file $file_name is not readable.
");
} ?>
</source>
is_readable() function checks the readability of both a file and a directory.
<source lang="html4strict">
Its syntax is: bool is_readable (string filename) <? $filename="data.txt"; if ( is_readable($filename) ) :
$fh = fopen($filename, "r");
else :
print "$filename Is not readable!";
endif; ?>
</source>
is_readable() tells you whether you can read a file.
<source lang="html4strict">
<? if ( is_readable( "data.txt" ) ) {
print "data.txt is readable";
} ?>
</source>