file.php 343 B

1234567891011121314
  1. <?php
  2. function get_mime_type($name) {
  3. $type = json_decode(file_get_contents("../modules/mime-db/db.json"));
  4. foreach ($type as $key => $value) {
  5. if (isset($value->extensions) && in_array(pathinfo($name, PATHINFO_EXTENSION), $value->extensions)) {
  6. $type = $key;
  7. break;
  8. };
  9. };
  10. return $type;
  11. };
  12. ?>