MimeDetect

Component ID

206535

Component name

MimeDetect

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

87073

Component created

Component changed

Component body

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, this module is part of the core, so the integration with non-core (third-party) modules like MimeDetect 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.

Modules using it

If you know any other module that makes use of MimeDetect, please report me.


How to collaborate

Note on security coverage

This module is on the way to get security coverage. As it may take some time, project maintainers offer security coverage in the meantime, just contact me. Please, remember not to report security issues in the project issue queue.