finfo_file
(PECL)
finfo_file -- Return information about a file
Description
string
finfo_file ( resource finfo, string file_name [, int options [, resource context]] )
class
finfo {
string
file ( string file_name [, int options [, resource context]] )
}
This function is used to get information about a file.
Return Values
Returns a textual description of the contents of the
filename argument, or FALSE if an error occurred.
Examples
Example 1. A finfo_file() example
<?php $finfo = finfo_open(FILEINFO_MIME); // return mime type ala mimetype extension foreach (glob("*") as $filename) { echo finfo_file($finfo, $filename) . "\n"; } finfo_close($finfo); ?>
|
The above example will output
something similar to: text/html
image/gif
application/vnd.ms-excel |
|