File_exists
(PHP 4 and PHP 5)
Description
Boolean file_exists (string $ file name)
Check whether a file or directory exists.
Parameters
File name
Path.
In Windows, use // Computer Name/shared/file name or computer name shared file name to check files on network sharing.
Return value
Returns TRUE if the specified file or directory file name exists, except FALSE.
Note: This function will return a FALSE symbolic link pointing to a non-existent file.
Warning
This function returns FALSE files because it is unable to enter the security mode. But these files can also contain if they are located in safe_mode_include_dir.
Note: The check results use real UID/GID and are not valid.
Instance
For example, if the #1 test file exists
<? Php
$ Filename = '/path/to/foo.txt ';
If (file_exists ($ filename )){
Echo "The file $ filename exists ";
} Else {
Echo "The file $ filename does not exist ";
}
?>