public function test_getFileMimes()
 {
     $tz = getFileMimes();
     $expected = array('mimetypes' => 'application/vnd.ms-excel', 'extensions' => 32);
     $result = array('mimetypes' => $tz['mimetypes'][32], 'extensions' => $tz['extensions']['xls']);
     $this->assertEquals($expected, $result);
 }
Example #2
0
 function getMimeTypeFor($ext, $default = 'application/octet-stream')
 {
     $ext = strtolower($ext);
     $a = getFileMimes();
     if (array_key_exists($ext, $a['extensions'])) {
         return $a['mimetypes'][$a['extensions'][$ext]];
     }
     return $default;
 }