Skip to content

Instantly share code, notes, and snippets.

@achraf-jeday
Forked from modcab/module.php
Created April 6, 2020 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achraf-jeday/5fe5b611c0693803086c9fcde0b41ee6 to your computer and use it in GitHub Desktop.
Save achraf-jeday/5fe5b611c0693803086c9fcde0b41ee6 to your computer and use it in GitHub Desktop.
Drupal 8 - Get MIME type from file uri.
<?php
$mime = \Drupal::service('file.mime_type.guesser')->guess($uri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment