finfo_file

finfo::file

Return information about a file

&reftitle.description;

&style.procedural;

``string``false```finfo_file` `finfo` `finfo` `string` `filename` `int` `flags` `FILEINFO_NONE` ``resource``null```context`&null;

&style.oop;

public ``string``false```finfo::file` `string` `filename` `int` `flags` `FILEINFO_NONE` ``resource``null```context`&null;

This function is used to get information about a file.

&reftitle.parameters;

`finfo`

- &fileinfo.parameters.finfo;

`filename`

- Name of a file to be checked.

`flags`

- 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.changelog;

&Version; | &Description;
&fileinfo.changelog.finfo-object;
8.0.0 | `context` is nullable now.

&reftitle.examples;

### A `finfo_file` example

    <?php
    $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type aka 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`