• PHP Video Tutorials

PHP - FileInfo mime_content_type() Function



The mime_content_type() function can detect MIME Content-type for a file (deprecated).

Syntax

string mime_content_type ( string $filename )

This function can return the MIME content type for a file as determined by using information from the magic.mime file. It can return the content type in MIME format, like text/plain or application/octet-stream.

Example

<?php
   echo mime_content_type("php.gif") . "\n";
   echo mime_content_type("test.php");
?>

Output

image/gif
text/plain
php_function_reference.htm
Advertisements