Mega Code Archive

 
Categories / Php / File Directory
 

Is the file readable

<html> <head> <title>Is the file readable: is_readable()</title> </head> <body> <?php $file = "test.txt"; outputFileTestInfo( $file ); function outputFileTestInfo( $f ){    if ( ! file_exists( $f ) ){        print "$f does not exist<BR>";       return;    }    print "$f is ".(is_readable( $f )?"":"not ")."readable<br>"; } ?> </body> </html>