The filetype() function returns the file type of a specified file or directory.
PHP filetype() Function has the following syntax.
filetype(filename)
Parameter | Is Required | Description |
filename | Required. | File to check |
This function returns the one of seven possible values on success or FALSE on failure.
Possible return values:
The result of this function are cached. Use clearstatcache() to clear the cache.
Returns the file type of a specified file or directory
<?php
echo filetype("test.txt");
echo "\n";
echo filetype("images");
?>