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;
?>