1 file.module | file_get_type($file) |
Determines file type for a given file.
Parameters
object $file: File object.
Return value
string: Machine name of file type that should be used for given file.
File
- core/
modules/ file/ file.module, line 2757 - Defines a "managed_file" Form API field and a "file" field for Field module.
Code
function file_get_type($file) {
$types = module_invoke_all('file_type', $file);
backdrop_alter('file_type', $types, $file);
return empty($types) ? NULL : reset($types);
}