finfo_file

finfo::file

Return information about a file

&reftitle.description;

&style.procedural;

`string` `finfo_file` `resource` `finfo` `string` `file_name`&null; `int` `options` FILEINFO_NONE `resource` `context`&null;

&style.oop;

public `string` `finfo::file` `string` `file_name`&null; `int` `options` FILEINFO_NONE `resource` `context`&null;

This function is used to get information about a file.

&reftitle.parameters;

`finfo`

- Fileinfo resource returned by `finfo_open`.

`file_name`

- Name of a file to be checked.

`options`

- One or disjunction of more Fileinfo constants.

`context`

- For a description of `contexts`, refer to ref.stream.

&reftitle.returnvalues;

Returns a textual description of the contents of the `filename` argument, or &false; if an error occurred.

&reftitle.examples;

### A `finfo_file` example

    <?php
    $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
    foreach (glob("*") as $filename) {
        echo finfo_file($finfo, $filename) . "\n";
    }
    finfo_close($finfo);
    ?>

&example.outputs.similar;

    text/html
    image/gif
    application/vnd.ms-excel

&reftitle.seealso;

- `finfo_buffer`