static function type($ext = '') { //if no ext, return generic binary stream if (!$ext) { return 'application/octet-stream'; } //Init class data if needed MIME::init(); //strip leading period if (strpos($ext, '.') === 0) { $ext = substr($ext, 1); } //check exists if (isset(MIME::$mime_types[$ext])) { return MIME::$mime_types[$ext]; } //return binary stream by default return 'application/octet-stream'; }