function drush_mime_content_type

8.0.x drush_mime_content_type($filename)
6.x drush_mime_content_type($filename)
7.x drush_mime_content_type($filename)
5.x drush_mime_content_type($filename)
master drush_mime_content_type($filename)

Determines the MIME content type of the specified file.

The power of this function depends on whether the PHP installation has either mime_content_type() or finfo installed -- if not, only tar, gz, zip and bzip2 types can be detected.

If mime type can't be obtained, an error will be set.

Return value

mixed The MIME content type of the file or FALSE.


includes/, line 875
The drush API implementation and helpers.


function drush_mime_content_type($filename) {
  $content_type = drush_attempt_mime_content_type($filename);
  if ($content_type) {
    drush_log(dt('Mime type for !file is !mt', array('!file' => $filename, '!mt' => $content_type)), LogLevel::INFO);
    return $content_type;
  return drush_set_error('MIME_CONTENT_TYPE_UNKNOWN', dt('Unable to determine mime type for !file.', array('!file' => $filename)));