• PHP Video Tutorials

PHP - FileInfo file() Function



The finfo_file() function can return information about a file.

Syntax

string finfo_file ( resource $finfo , string $file_name [, int $options [, resource $context ]] )
finfo
string file ( string $file_name [, int $options [, resource $context ]] )

The finfo_file() function is used to get the information about a file, and it can return a textual description of the contents of the filename argument, or false if an error occurred.

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);
?>
php_function_reference.htm
Advertisements