function hook_file_mimetype_mapping_alter
hook_file_mimetype_mapping_alter(&$mapping)
Alter MIME type mappings used to determine MIME type from a file extension.
This hook is run when file_mimetype_mapping() is called. It is used to allow modules to add to or modify the default mapping from file_default_mimetype_mapping().
Parameters
$mapping: An array of mimetypes correlated to the extensions that relate to them. The array has 'mimetypes' and 'extensions' elements, each of which is an array.
See also
file_default_mimetype_mapping()
Related topics
File
- modules/system/system.api.php, line 3948
- Hooks provided by Drupal core and the System module.
Code
function hook_file_mimetype_mapping_alter(&$mapping) { // Add new MIME type 'drupal/info'. $mapping['mimetypes']['example_info'] = 'drupal/info'; // Add new extension '.info' and map it to the 'drupal/info' MIME type. $mapping['extensions']['info'] = 'example_info'; // Override existing extension mapping for '.ogg' files. $mapping['extensions']['ogg'] = 189; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_file_mimetype_mapping_alter/7.x