1 file.module file_type_get_name($file)

Returns the file type name of the passed file or file type string.

Parameters

$file: A file object or string that indicates the file type to return.

Return value

The file type name or FALSE if the file type is not found.:

File

core/modules/file/file.module, line 2299
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_type_get_name($file) {
  $type = is_object($file) ? $file->type : $file;
  $info = entity_get_info('file');

  return isset($info['bundles'][$type]['label']) ? $info['bundles'][$type]['label'] : FALSE;
}