is_readable()
Use this function to determine if a file is readable. A file will need to have read permissions for you to perform file_get_contents() and similar functions on it.
If the file doesn’t exist or does not have read permissions, false is returned. Can also be used on directories.
if( is_readable( 'output.txt' ) ) { file_get_contents( 'output.txt' ); } $is_it = is_readable( 'does_not_exist.php' ); // false $is_it = is_readable( '/my/existing/dir' ); // true
See the manual entry for is_readable()
