/**
  * Gets a file's MIME type. 
  *
  * @param string $fname file name for which to get MIME type
  *
  * @return void
  */
 public static function getFileMIMEType($fname)
 {
     // TODO: Move to file util
     // lazy init
     if (self::$_fileInfo == null) {
         self::$_fileInfo = new finfo(FILEINFO_MIME);
     }
     return self::$_fileInfo->file($fname);
 }
Exemplo n.º 2
0
 /**
  * Gets a file's MIME type. 
  *
  * @param string $fname file name for which to get MIME type
  *
  * @return void
  */
 public static function getFileMIMEType($fname)
 {
     // TODO: Move to file util
     // Try getMimeType2 first, if unknown go to finfo
     $ftype = Util::getMimeType2($fname);
     if ($ftype != 'unknown') {
         return $ftype;
     }
     // lazy init
     if (self::$_fileInfo == null) {
         self::$_fileInfo = new finfo(FILEINFO_MIME);
     }
     return self::$_fileInfo->file($fname);
 }