PHP File exists


The file_exists() function checks whether a file or directory exists and returns TRUE if successful, or FALSE otherwise.

grammar:

bool file_exists(string filename)

example:

$filename='test.txt';
if (file_exists($filename)) {
     echo "file $filename exists";
} else {
     echo "file $filename does not exist";
}



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook