Verify if the filename provided is a normal file
<?php $file = “test.txt”; if(is_file($file)) { echo (“$file is a regular file”); } else { echo (“$file is not a regular file”); } ?> |
What the code above might produce is:
test.txt is a regular file |
The method is_file() determines if the given filename is a regular file or not.
Note: This function caches its output. To clear the cache, use clearstatcache().
is_file(file) |
Parameter |
Description |
file |
Essential. gives the location of the file to be checked. |
Return Value: |
If the file is a regular file, then TRUE; if not, then FALSE |
PHP Version: |
4.0+ |