mimedetect drupal module icon

MimeDetect provides a complete system for detecting the actual content of files in your Drupal site.

By default, Drupal provides a "guessing" system based on the filename extension. This is very weak and your site could store files with real content different from the one indicated by its extension.

MimeDetect provides detection on two levels:

  1. Programmatic detection (D8 only)
    A way of file content detection by coding specific plugins. For example, CSV files are often detected as "text/plain". MimeDetect comes with a plugin that examines the actual content of files with .csv extension and determines whether or not they are in CSV format ("text/csv"). You can also develop your own plugin to detect unusual or undetectable content types by other tools.

  2. MIME 'magic' method
    the traditional MIME detection method, provided by the PHP fileinfo extension and / or the UNIX 'file' command.

File upload validation

Drupal 6 file field module has integration with MimeDetect. Since Drupal 7, file field is in core, so the integration with third-party modules was lost.

This functionality is now provided by the "MimeDetect file upload validator" submodule present in D7 & D8 versions of the module, included for backward compatibility and to provide basic functionality.


How to collaborate

Supporting organizations: 

Project information

Releases