Skip to content

Instantly share code, notes, and snippets.

@modcab
Created July 12, 2017 12:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save modcab/f178864fb515e16ccfa4c6e006e9159e to your computer and use it in GitHub Desktop.
Save modcab/f178864fb515e16ccfa4c6e006e9159e 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