is_file() function returns true if file exists and is a readable/writable file. : is_file « File Directory « PHP






is_file() function returns true if file exists and is a readable/writable file.

 
bool is_file (string file)

<?
    $file = "data.txt";
    if (is_file($file)) :
         print "The file $file is valid and exists!";
    else :
         print "Either $file does not exist or it is not a valid file!";
    endif;
?>
  
  








Related examples in the same category

1.A File or a Directory?