webCOMAND

mime_type::get_info_from_data()

Get information about a file format based on file data.

Prototype

array get_info_from_data(string $data)

Parameters

  • data - A string containing the text or binary data of a file.

Return

An associative array with the following keys.

  • mime - The MIME Type string.
  • ext - The corresponding file extension.
  • text - TRUE if this MIME Type is a plain text format.
  • title - Human readable file format description.
  • short - Short human readable file format.

Example

// print information about the PDF file format
$filename = 'article.pdf';
$data = file_get_contents($filename);
$info = \io_comand_util\mime_type::get_info_from_data($data);
print_r($info);