Преглед изворни кода

added upload stream, mime type check, store client ip, view last files in FileStorage

Piotr Labudda пре 9 година
родитељ
комит
bd36377dcf
2 измењених фајлова са 987 додато и 31 уклоњено
  1. 14 0
      SE/se-lib/Request.php
  2. 973 31
      SE/se-lib/Route/FileStorage.php

+ 14 - 0
SE/se-lib/Request.php

@@ -77,4 +77,18 @@ class Request {
 		return $requestBody;
 		return $requestBody;
 	}
 	}
 
 
+	// @usage: Request::getUserIp();
+	public static function getUserIp() {
+		static $ip = null;
+		if (null !== $ip) return $ip;
+		if (isset($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP'];
+		else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+		else if (isset($_SERVER['HTTP_X_FORWARDED'])) $ip = $_SERVER['HTTP_X_FORWARDED'];
+		else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_FORWARDED_FOR'];
+		else if (isset($_SERVER['HTTP_FORWARDED'])) $ip = $_SERVER['HTTP_FORWARDED'];
+		else if (isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
+		else $ip = 'UNKNOWN';
+		return $ip;
+	}
+
 }
 }

+ 973 - 31
SE/se-lib/Route/FileStorage.php

@@ -2,10 +2,10 @@
 // @requires $_SERVER['SERVER_NAME']
 // @requires $_SERVER['SERVER_NAME']
 
 
 Lib::loadClass('RouteBase');
 Lib::loadClass('RouteBase');
-Lib::loadClass('Schema_TableFactory');
 Lib::loadClass('Response');
 Lib::loadClass('Response');
+Lib::loadClass('Request');
 Lib::loadClass('UI');
 Lib::loadClass('UI');
-Lib::loadClass('OBJ');
+Lib::loadClass('Http');
 
 
 /*
 /*
 # FileStorage:
 # FileStorage:
@@ -15,7 +15,15 @@ Lib::loadClass('OBJ');
   - [ ] base storage folder - from config - default /Library/Server/Web/Data/p5-pliki, chmod - add to instalator, upgrade
   - [ ] base storage folder - from config - default /Library/Server/Web/Data/p5-pliki, chmod - add to instalator, upgrade
 	- [x] subfolders like postfix, but [0-9],[A-Z] - substr(strrev(base_convert($id, 10, 10 + 26)), 0, 1) - 36 folderów
 	- [x] subfolders like postfix, but [0-9],[A-Z] - substr(strrev(base_convert($id, 10, 10 + 26)), 0, 1) - 36 folderów
 	- [x] file connected to user - A_RECORD_CREATE_AUTHOR
 	- [x] file connected to user - A_RECORD_CREATE_AUTHOR
+	- [ ] ? file connected to user - A_OWNER (L_APP_USER)?
 - [ ] connect file to record - {tbl_name}__REF__FILES
 - [ ] connect file to record - {tbl_name}__REF__FILES
+  - [ ] add A_HAS_REF field to struct - cache to check if file is connected to some record
+	- [ ] add sync state - remote file name, mtime to check if file has changed in Storage or remote record folder
+	- [ ] sync - conflict - file connected with 2 objects and both changed and try to store changes to FileStorage
+	  - [ ] add version to REF table
+- [x] use streams for upload - better memory usage
+- [ ] use streams for upload progress in form - http://www.webiny.com/blog/2012/05/07/webiny-file-upload-with-html5-and-ajax-using-php-streams/
+- [x] add IP to table struct
 
 
 # upload API: `index.php?_route=FileStorage&_task=upload&name={file_name}`
 # upload API: `index.php?_route=FileStorage&_task=upload&name={file_name}`
 
 
@@ -54,14 +62,88 @@ class Route_FileStorage extends RouteBase {
 		return ($this->isProduction()) ? 'CRM_FILES' : 'CRM_FILES__#DEV';
 		return ($this->isProduction()) ? 'CRM_FILES' : 'CRM_FILES__#DEV';
 	}
 	}
 
 
+	public function addFileStream($inputHandler, $name = '') {
+		$rootFileStoragePath = $this->getRootStoragePath();
+
+		$sqlLogin = User::getLogin();
+		$sqlIP = Request::getUserIp();
+		$sqlLabel = DB::getPDO()->quote($name, PDO::PARAM_STR);
+		$sqlTblName = $this->getTableName();
+		$sql = "
+			insert into `{$sqlTblName}` (`A_RECORD_CREATE_AUTHOR`,`A_RECORD_CREATE_DATE`,`FILE_LABEL`, `A_USER_IP`)
+			values ('{$sqlLogin}', NOW(), {$sqlLabel}, INET_ATON('{$sqlIP}'))
+		";
+		DBG::_('DBG', '>2', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
+		DB::getPDO()->exec($sql);
+		$dbLastId = DB::getPDO()->lastInsertId();
+		DBG::_('DBG', '>1', "dbLastId", $dbLastId, __CLASS__, __FUNCTION__, __LINE__);
+		$filePath = $this->generateFilePathHashFromID($dbLastId);
+		DBG::_('DBG', '>1', "filePath", $filePath, __CLASS__, __FUNCTION__, __LINE__);
+
+		$absFilePath = "{$rootFileStoragePath}/{$filePath}";
+		$dirPath = dirname($absFilePath);
+		@mkdir($dirPath, $mode = 0775, $recursive = true);
+		if (!file_exists($dirPath)) throw new Exception("Cannot create path");
+		@chmod($dirPath, $mode = 0775);
+
+		// create a temp file where to save data from the input stream
+		$fileHandler = fopen($absFilePath, "w+");
+		DBG::_('DBG', '>1', "absFilePath", $absFilePath, __CLASS__, __FUNCTION__, __LINE__);
+
+		// save data from the input stream
+		while (true) {
+			$buffer = fgets($inputHandler, 4096);
+			if (strlen($buffer) == 0) {
+				fclose($inputHandler);
+				fclose($fileHandler);
+				break;
+			}
+			fwrite($fileHandler, $buffer);
+		}
+
+		if (!file_exists($absFilePath)) throw new Exception("Cannot save file");
+
+		$mimeType = mime_content_type($absFilePath);
+		DBG::_('DBG', '>1', "mimeType", $mimeType, __CLASS__, __FUNCTION__, __LINE__);
+		if (!$this->isAllowedMimeType($mimeType)) {
+			DB::getPDO()->exec("
+				update `{$sqlTblName}`
+				set `A_STATUS` = 'WARNING'
+			--		, `A_STATUS_INFO` = ''
+				where `ID` = '{$dbLastId}'
+			");
+			throw new Exception("Niedozwolony typ pliku '{$mimeType}'", 1);
+		}
+		$mtime = filemtime($absFilePath);
+		$size = filesize($absFilePath);
+		DBG::_('DBG', '>1', "mtime", $mtime, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::_('DBG', '>1', "size", $size, __CLASS__, __FUNCTION__, __LINE__);
+		DB::getPDO()->exec("
+			update `{$sqlTblName}`
+			set `A_STATUS` = 'NORMAL'
+				, `FILE_MIME_TYPE` = '{$mimeType}'
+				, `FILE_MTIME` = '{$mtime}'
+				, `FILE_SIZE` = '{$size}'
+			where `ID` = '{$dbLastId}'
+		");
+		echo "
+			update `{$sqlTblName}`
+			set `A_STATUS` = 'NORMAL'
+				, `FILE_MIME_TYPE` = '{$mimeType}'
+				, `FILE_MTIME` = '{$mtime}'
+				, `FILE_SIZE` = '{$size}'
+			where `ID` = '{$dbLastId}'
+		";
+	}
+
 	public function addFile($content, $name = '') {
 	public function addFile($content, $name = '') {
 		$rootFileStoragePath = $this->getRootStoragePath();
 		$rootFileStoragePath = $this->getRootStoragePath();
 
 
 		$sqlLogin = User::getLogin();
 		$sqlLogin = User::getLogin();
-		$sqlLabel = DB::getPDO()->quote($sqlLabel, PDO::PARAM_STR);
+		$sqlLabel = DB::getPDO()->quote($name, PDO::PARAM_STR);
 		$sqlTblName = $this->getTableName();
 		$sqlTblName = $this->getTableName();
 		$sql = "
 		$sql = "
-			insert into {$sqlTblName} (`A_RECORD_CREATE_AUTHOR`,`A_RECORD_CREATE_DATE`,`FILE_LABEL`)
+			insert into `{$sqlTblName}` (`A_RECORD_CREATE_AUTHOR`,`A_RECORD_CREATE_DATE`,`FILE_LABEL`)
 			values ('{$sqlLogin}', NOW(), {$sqlLabel})
 			values ('{$sqlLogin}', NOW(), {$sqlLabel})
 		";
 		";
 		DBG::_('DBG', '>2', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
 		DBG::_('DBG', '>2', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
@@ -81,7 +163,21 @@ class Route_FileStorage extends RouteBase {
 		fwrite($fp, $fileContent);
 		fwrite($fp, $fileContent);
 		fclose($fp);
 		fclose($fp);
 
 
-		if (!file_exists($dirPath)) throw new Exception("Cannot save file");
+		if (!file_exists($absFilePath)) throw new Exception("Cannot save file");
+	}
+
+	public function uploadStreamAction() {
+		try {
+			$sqlLabel = V::get('name', '', $_REQUEST);
+			// read contents from the input stream
+			$inputHandler = fopen('php://input', "r");
+			$this->addFileStream($inputHandler, $sqlLabel);
+		} catch (Exception $e) {
+			Http::sendHeaderByCode(500);
+			echo "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage();
+			exit;
+		}
+		Http::sendHeaderByCode(200);
 	}
 	}
 
 
 	public function uploadAction() {
 	public function uploadAction() {
@@ -154,14 +250,48 @@ class Route_FileStorage extends RouteBase {
 	<form>
 	<form>
 		<input type="file" id="file_input" style="display:block; width:100%; height:200px; background-color:silver; text-align:center">
 		<input type="file" id="file_input" style="display:block; width:100%; height:200px; background-color:silver; text-align:center">
 	</form>
 	</form>
-	<button class="btn btn-primary" id="upload_file_as_binary_btn">upload as binary</button>
+	<button class="btn btn-primary" id="upload_file_as_stream_btn">upload as stream</button>
+	<button class="btn btn-success" id="upload_file_as_binary_btn">upload as binary</button>
 	<button class="btn btn-default" id="upload_file_as_form_btn">upload as form</button>
 	<button class="btn btn-default" id="upload_file_as_form_btn">upload as form</button>
 	<a class="btn btn-default" href="index.php?_route=FileStorage&_task=downloadTest" target="_blank">download</a>
 	<a class="btn btn-default" href="index.php?_route=FileStorage&_task=downloadTest" target="_blank">download</a>
 	<blockquote>
 	<blockquote>
 		<p>root storage path: <code><?php echo $this->getRootStoragePath(); ?></code></p>
 		<p>root storage path: <code><?php echo $this->getRootStoragePath(); ?></code></p>
 		<p>table name: <code><?php echo $this->getTableName(); ?></code></p>
 		<p>table name: <code><?php echo $this->getTableName(); ?></code></p>
+		<p>IP: <code><?php echo Request::getUserIp(); ?></code></p>
 	</blockquote>
 	</blockquote>
 </div>
 </div>
+<?php
+$sqlTblName = $this->getTableName();
+$rows = DB::getPDO()->fetchAll("
+	select t.ID
+		, t.FILE_HASH
+		, t.FILE_LABEL
+		, t.FILE_TYPE
+		, t.FILE_MIME_TYPE
+		, t.FILE_MTIME
+		, t.FILE_SIZE
+		, t.FILE_VERSION
+		, t.A_STATUS
+		, t.A_RECORD_CREATE_DATE as created
+		, t.A_RECORD_CREATE_AUTHOR as author
+		, t.A_RECORD_UPDATE_DATE as updated
+		, t.A_RECORD_UPDATE_AUTHOR as editor
+		, t.A_ADM_COMPANY as zapisDla
+		, t.A_CLASSIFIED as odczytDla
+		, INET_NTOA(t.A_USER_IP) as IP
+	from `{$sqlTblName}` t
+	order by ID DESC
+	limit 100
+");
+foreach ($rows as $idx => $row) {
+	$rows[$idx]['FILE_SIZE'] = V::humanFileSize($row['FILE_SIZE']);
+}
+
+$params = array();
+$params['caption'] = "Files in '" . $this->getTableName() . "'";
+$params['rows'] = $rows;
+UI::table($params);
+?>
 <script>
 <script>
 document.getElementById('file_input').addEventListener('change', function() {
 document.getElementById('file_input').addEventListener('change', function() {
   for (var i = 0; i < this.files.length; i++){
   for (var i = 0; i < this.files.length; i++){
@@ -190,8 +320,19 @@ function uploadFileAsForm(file) {
   fd.append("upload_file", file);
   fd.append("upload_file", file);
   xhr.send(fd);
   xhr.send(fd);
 }
 }
+function uploadFileAsStream(file) {
+	var serverUrl = '<?php echo Request::getPathUri() . "index.php?_route=FileStorage&_task=uploadStream&DBG=3"; ?>';
+	var _dbg = true;
+
+	// .set('Accept', 'application/json')
+	superagent.post(serverUrl + '&name=' + file.name)
+		.set('Content-Type', file.type)
+		.send(file)
+		.end(function(err, res) {
+			if(_dbg)console.log('DBG: res:', res, 'res.body:', res.body);
+		})
+}
 function uploadFileAsBinary(file) {
 function uploadFileAsBinary(file) {
-	var serverUrl = '<?php echo Request::getPathUri() . "index.php?_route=FileStorage&_task=uploadFromBinaryTest"; ?>';
 	var serverUrl = '<?php echo Request::getPathUri() . "index.php?_route=FileStorage&_task=upload"; ?>';
 	var serverUrl = '<?php echo Request::getPathUri() . "index.php?_route=FileStorage&_task=upload"; ?>';
 	var _dbg = true;
 	var _dbg = true;
 
 
@@ -224,6 +365,15 @@ return
   })
   })
 }
 }
 
 
+jQuery('#upload_file_as_stream_btn').on('click', function() {
+	var fileInput = document.getElementById('file_input')
+	if (!fileInput) return false;// TODO: error msg
+	if (!fileInput.files) return false;// TODO: error msg
+	if (!fileInput.files.length) return false;// TODO: error msg
+	var fileInfo = fileInput.files[0];
+	console.log('fileInfo', fileInfo);
+	uploadFileAsStream(fileInfo);
+});
 jQuery('#upload_file_as_binary_btn').on('click', function() {
 jQuery('#upload_file_as_binary_btn').on('click', function() {
 	var fileInput = document.getElementById('file_input')
 	var fileInput = document.getElementById('file_input')
 	if (!fileInput) return false;// TODO: error msg
 	if (!fileInput) return false;// TODO: error msg
@@ -290,40 +440,46 @@ jQuery('#upload_file_as_form_btn').on('click', function() {
 		try {
 		try {
 			DB::getPDO()->exec("
 			DB::getPDO()->exec("
 CREATE TABLE IF NOT EXISTS `CRM_FILES` (
 CREATE TABLE IF NOT EXISTS `CRM_FILES` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
-  `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
-  `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
-  `FILE_MTIME` datetime NOT NULL,
-  `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
-  `A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED') NOT NULL DEFAULT 'WAITING',
-  `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
-  `A_RECORD_CREATE_AUTHOR` varchar(40) NOT NULL DEFAULT '',
-  `A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) NOT NULL DEFAULT '',
+	`ID` int(11) NOT NULL AUTO_INCREMENT,
+	`FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
+	`FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
+	`FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
+	`FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
+	`FILE_MTIME` datetime NOT NULL,
+	`FILE_SIZE` bigint NOT NULL DEFAULT 0,
+	`FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
+	`A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED') NOT NULL DEFAULT 'WAITING',
+	`A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
+	`A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
+	`A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
+	`A_RECORD_UPDATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
 	`A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
 	`A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
 	`A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
 	`A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
-  PRIMARY KEY (`ID`),
-  KEY `FILE_TYPE` (`FILE_TYPE`)
+	`A_USER_IP` bigint NOT NULL DEFAULT '0',
+	PRIMARY KEY (`ID`),
+	KEY `FILE_TYPE` (`FILE_MIME_TYPE`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
 			");
 			");
 			DB::getPDO()->exec("
 			DB::getPDO()->exec("
 CREATE TABLE IF NOT EXISTS `CRM_FILES__#DEV` (
 CREATE TABLE IF NOT EXISTS `CRM_FILES__#DEV` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
+	`ID` int(11) NOT NULL AUTO_INCREMENT,
+	`FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
   `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
   `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
   `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
   `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
-  `FILE_MTIME` datetime NOT NULL,
-  `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
-  `A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED') NOT NULL DEFAULT 'WAITING',
-  `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
-  `A_RECORD_CREATE_AUTHOR` varchar(40) NOT NULL DEFAULT '',
-  `A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) NOT NULL DEFAULT '',
+	`FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
+	`FILE_MTIME` datetime NOT NULL,
+	`FILE_SIZE` bigint NOT NULL DEFAULT 0,
+	`FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
+	`A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED') NOT NULL DEFAULT 'WAITING',
+	`A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
+	`A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
+	`A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
+	`A_RECORD_UPDATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
 	`A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
 	`A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
 	`A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
 	`A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
-  PRIMARY KEY (`ID`),
-  KEY `FILE_TYPE` (`FILE_TYPE`)
+	`A_USER_IP` bigint NOT NULL DEFAULT '0',
+	PRIMARY KEY (`ID`),
+	KEY `FILE_TYPE` (`FILE_MIME_TYPE`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
 			");
 			");
 
 
@@ -349,4 +505,790 @@ CREATE TABLE IF NOT EXISTS `CRM_FILES__#DEV` (
 		}
 		}
 	}
 	}
 
 
+	public function isAllowedMimeType($mimeType) {
+		// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+		switch ($mimeType) {
+			case 'image/png': return true;
+			case 'application/atom+xml': return true;// atom
+			case 'application/atomcat+xml': return true;// atomcat
+			case 'application/atomsvc+xml': return true;// atomsvc
+			case 'application/ccxml+xml': return true;// ccxml
+			case 'application/cdmi-capability': return true;// cdmia
+			case 'application/cdmi-container': return true;// cdmic
+			case 'application/cdmi-domain': return true;// cdmid
+			case 'application/cdmi-object': return true;// cdmio
+			case 'application/cdmi-queue': return true;// cdmiq
+			case 'application/cu-seeme': return true;// cu
+			case 'application/davmount+xml': return true;// davmount
+			case 'application/docbook+xml': return true;// dbk
+			case 'application/dssc+der': return true;// dssc
+			case 'application/dssc+xml': return true;// xdssc
+			case 'application/ecmascript': return true;// ecma
+			case 'application/emma+xml': return true;// emma
+			case 'application/epub+zip': return true;// epub
+			case 'application/exi': return true;// exi
+			case 'application/font-tdpfr': return true;// pfr
+			case 'application/font-woff': return true;// woff
+			case 'application/gml+xml': return true;// gml
+			case 'application/gpx+xml': return true;// gpx
+			case 'application/gxf': return true;// gxf
+			case 'application/hyperstudio': return true;// stk
+			case 'application/inkml+xml': return true;// ink inkml
+			case 'application/ipfix': return true;// ipfix
+			case 'application/java-archive': return true;// jar
+			case 'application/java-serialized-object': return true;// ser
+			case 'application/java-vm': return true;// class
+			case 'application/javascript': return true;// js
+			case 'application/json': return true;// json
+			case 'application/jsonml+json': return true;// jsonml
+			case 'application/lost+xml': return true;// lostxml
+			case 'application/mac-binhex40': return true;// hqx
+			case 'application/mac-compactpro': return true;// cpt
+			case 'application/mads+xml': return true;// mads
+			case 'application/marc': return true;// mrc
+			case 'application/marcxml+xml': return true;// mrcx
+			case 'application/mathematica': return true;// ma nb mb
+			case 'application/mathml+xml': return true;// mathml
+			case 'application/mbox': return true;// mbox
+			case 'application/mediaservercontrol+xml': return true;// mscml
+			case 'application/metalink+xml': return true;// metalink
+			case 'application/metalink4+xml': return true;// meta4
+			case 'application/mets+xml': return true;// mets
+			case 'application/mods+xml': return true;// mods
+			case 'application/mp21': return true;// m21 mp21
+			case 'application/mp4': return true;// mp4s
+			case 'application/msword': return true;// doc dot
+			case 'application/mxf': return true;// mxf
+			case 'application/octet-stream': return true;// bin dms lrf mar so dist distz pkg bpk dump elc deploy
+			case 'application/oda': return true;// oda
+			case 'application/oebps-package+xml': return true;// opf
+			case 'application/ogg': return true;// ogx
+			case 'application/omdoc+xml': return true;// omdoc
+			case 'application/onenote': return true;// onetoc2 onetmp onetoc onepkg
+			case 'application/oxps': return true;// oxps
+			case 'application/patch-ops-error+xml': return true;// xer
+			case 'application/pdf': return true;// pdf
+			case 'application/pgp-encrypted': return true;// pgp
+			case 'application/pgp-signature': return true;// asc sig
+			case 'application/pics-rules': return true;// prf
+			case 'application/pkcs10': return true;// p10
+			case 'application/pkcs7-mime': return true;// p7m p7c
+			case 'application/pkcs7-signature': return true;// p7s
+			case 'application/pkcs8': return true;// p8
+			case 'application/pkix-attr-cert': return true;// ac
+			case 'application/pkix-cert': return true;// cer
+			case 'application/pkix-crl': return true;// crl
+			case 'application/pkix-pkipath': return true;// pkipath
+			case 'application/pkixcmp': return true;// pki
+			case 'application/pls+xml': return true;// pls
+			case 'application/postscript': return true;// ai eps ps
+			case 'application/prs.cww': return true;// cww
+			case 'application/pskc+xml': return true;// pskcxml
+			case 'application/rdf+xml': return true;// rdf
+			case 'application/reginfo+xml': return true;// rif
+			case 'application/relax-ng-compact-syntax': return true;// rnc
+			case 'application/resource-lists+xml': return true;// rl
+			case 'application/resource-lists-diff+xml': return true;// rld
+			case 'application/rls-services+xml': return true;// rs
+			case 'application/rpki-ghostbusters': return true;// gbr
+			case 'application/rpki-manifest': return true;// mft
+			case 'application/rpki-roa': return true;// roa
+			case 'application/rsd+xml': return true;// rsd
+			case 'application/rss+xml': return true;// rss
+			case 'application/rtf': return true;// rtf
+			case 'application/sbml+xml': return true;// sbml
+			case 'application/scvp-cv-request': return true;// scq
+			case 'application/scvp-cv-response': return true;// scs
+			case 'application/scvp-vp-request': return true;// spq
+			case 'application/scvp-vp-response': return true;// spp
+			case 'application/sdp': return true;// sdp
+			case 'application/set-payment-initiation': return true;// setpay
+			case 'application/set-registration-initiation': return true;// setreg
+			case 'application/shf+xml': return true;// shf
+			case 'application/smil+xml': return true;// smi smil
+			case 'application/sparql-query': return true;// rq
+			case 'application/sparql-results+xml': return true;// srx
+			case 'application/srgs': return true;// gram
+			case 'application/srgs+xml': return true;// grxml
+			case 'application/sru+xml': return true;// sru
+			case 'application/ssdl+xml': return true;// ssdl
+			case 'application/ssml+xml': return true;// ssml
+			case 'application/tei+xml': return true;// tei teicorpus
+			case 'application/thraud+xml': return true;// tfi
+			case 'application/timestamped-data': return true;// tsd
+			case 'application/vnd.3gpp.pic-bw-large': return true;// plb
+			case 'application/vnd.3gpp.pic-bw-small': return true;// psb
+			case 'application/vnd.3gpp.pic-bw-var': return true;// pvb
+			case 'application/vnd.3gpp2.tcap': return true;// tcap
+			case 'application/vnd.3m.post-it-notes': return true;// pwn
+			case 'application/vnd.accpac.simply.aso': return true;// aso
+			case 'application/vnd.accpac.simply.imp': return true;// imp
+			case 'application/vnd.acucobol': return true;// acu
+			case 'application/vnd.acucorp': return true;// atc acutc
+			case 'application/vnd.adobe.air-application-installer-package+zip': return true;// air
+			case 'application/vnd.adobe.formscentral.fcdt': return true;// fcdt
+			case 'application/vnd.adobe.fxp': return true;// fxp fxpl
+			case 'application/vnd.adobe.xdp+xml': return true;// xdp
+			case 'application/vnd.adobe.xfdf': return true;// xfdf
+			case 'application/vnd.ahead.space': return true;// ahead
+			case 'application/vnd.airzip.filesecure.azf': return true;// azf
+			case 'application/vnd.airzip.filesecure.azs': return true;// azs
+			case 'application/vnd.amazon.ebook': return true;// azw
+			case 'application/vnd.americandynamics.acc': return true;// acc
+			case 'application/vnd.amiga.ami': return true;// ami
+			case 'application/vnd.android.package-archive': return true;// apk
+			case 'application/vnd.anser-web-certificate-issue-initiation': return true;// cii
+			case 'application/vnd.anser-web-funds-transfer-initiation': return true;// fti
+			case 'application/vnd.antix.game-component': return true;// atx
+			case 'application/vnd.apple.installer+xml': return true;// mpkg
+			case 'application/vnd.apple.mpegurl': return true;// m3u8
+			case 'application/vnd.aristanetworks.swi': return true;// swi
+			case 'application/vnd.astraea-software.iota': return true;// iota
+			case 'application/vnd.audiograph': return true;// aep
+			case 'application/vnd.blueice.multipass': return true;// mpm
+			case 'application/vnd.bmi': return true;// bmi
+			case 'application/vnd.businessobjects': return true;// rep
+			case 'application/vnd.chemdraw+xml': return true;// cdxml
+			case 'application/vnd.chipnuts.karaoke-mmd': return true;// mmd
+			case 'application/vnd.cinderella': return true;// cdy
+			case 'application/vnd.claymore': return true;// cla
+			case 'application/vnd.cloanto.rp9': return true;// rp9
+			case 'application/vnd.clonk.c4group': return true;// c4g c4d c4f c4p c4u
+			case 'application/vnd.cluetrust.cartomobile-config': return true;// c11amc
+			case 'application/vnd.cluetrust.cartomobile-config-pkg': return true;// c11amz
+			case 'application/vnd.commonspace': return true;// csp
+			case 'application/vnd.contact.cmsg': return true;// cdbcmsg
+			case 'application/vnd.cosmocaller': return true;// cmc
+			case 'application/vnd.crick.clicker': return true;// clkx
+			case 'application/vnd.crick.clicker.keyboard': return true;// clkk
+			case 'application/vnd.crick.clicker.palette': return true;// clkp
+			case 'application/vnd.crick.clicker.template': return true;// clkt
+			case 'application/vnd.crick.clicker.wordbank': return true;// clkw
+			case 'application/vnd.criticaltools.wbs+xml': return true;// wbs
+			case 'application/vnd.ctc-posml': return true;// pml
+			case 'application/vnd.cups-ppd': return true;// ppd
+			case 'application/vnd.curl.car': return true;// car
+			case 'application/vnd.curl.pcurl': return true;// pcurl
+			case 'application/vnd.dart': return true;// dart
+			case 'application/vnd.data-vision.rdz': return true;// rdz
+			case 'application/vnd.dece.data': return true;// uvf uvvf uvd uvvd
+			case 'application/vnd.dece.ttml+xml': return true;// uvt uvvt
+			case 'application/vnd.dece.unspecified': return true;// uvx uvvx
+			case 'application/vnd.dece.zip': return true;// uvz uvvz
+			case 'application/vnd.denovo.fcselayout-link': return true;// fe_launch
+			case 'application/vnd.dna': return true;// dna
+			case 'application/vnd.dolby.mlp': return true;// mlp
+			case 'application/vnd.dpgraph': return true;// dpg
+			case 'application/vnd.dreamfactory': return true;// dfac
+			case 'application/vnd.ds-keypoint': return true;// kpxx
+			case 'application/vnd.dvb.ait': return true;// ait
+			case 'application/vnd.dvb.service': return true;// svc
+			case 'application/vnd.dynageo': return true;// geo
+			case 'application/vnd.ecowin.chart': return true;// mag
+			case 'application/vnd.enliven': return true;// nml
+			case 'application/vnd.epson.esf': return true;// esf
+			case 'application/vnd.epson.msf': return true;// msf
+			case 'application/vnd.epson.quickanime': return true;// qam
+			case 'application/vnd.epson.salt': return true;// slt
+			case 'application/vnd.epson.ssf': return true;// ssf
+			case 'application/vnd.eszigno3+xml			es3': return true;// et3
+			case 'application/vnd.ezpix-album': return true;// ez2
+			case 'application/vnd.ezpix-package': return true;// ez3
+			case 'application/vnd.fdf': return true;// fdf
+			case 'application/vnd.fdsn.mseed': return true;// mseed
+			case 'application/vnd.fdsn.seed': return true;// seed dataless
+			case 'application/vnd.flographit': return true;// gph
+			case 'application/vnd.fluxtime.clip': return true;// ftc
+			case 'application/vnd.framemaker': return true;// fm frame maker book
+			case 'application/vnd.frogans.fnc': return true;// fnc
+			case 'application/vnd.frogans.ltf': return true;// ltf
+			case 'application/vnd.fsc.weblaunch': return true;// fsc
+			case 'application/vnd.fujitsu.oasys': return true;// oas
+			case 'application/vnd.fujitsu.oasys2': return true;// oa2
+			case 'application/vnd.fujitsu.oasys3': return true;// oa3
+			case 'application/vnd.fujitsu.oasysgp': return true;// fg5
+			case 'application/vnd.fujitsu.oasysprs': return true;// bh2
+			case 'application/vnd.fujixerox.ddd': return true;// ddd
+			case 'application/vnd.fujixerox.docuworks': return true;// xdw
+			case 'application/vnd.fujixerox.docuworks.binder': return true;// xbd
+			case 'application/vnd.fuzzysheet': return true;// fzs
+			case 'application/vnd.genomatix.tuxedo': return true;// txd
+			case 'application/vnd.geogebra.file': return true;// ggb
+			case 'application/vnd.geogebra.tool': return true;// ggt
+			case 'application/vnd.geometry-explorer': return true;// gex gre
+			case 'application/vnd.geonext': return true;// gxt
+			case 'application/vnd.geoplan': return true;// g2w
+			case 'application/vnd.geospace': return true;// g3w
+			case 'application/vnd.gmx': return true;// gmx
+			case 'application/vnd.google-earth.kml+xml': return true;// kml
+			case 'application/vnd.google-earth.kmz': return true;// kmz
+			case 'application/vnd.grafeq': return true;// gqf gqs
+			case 'application/vnd.groove-account': return true;// gac
+			case 'application/vnd.groove-help': return true;// ghf
+			case 'application/vnd.groove-identity-message': return true;// gim
+			case 'application/vnd.groove-injector': return true;// grv
+			case 'application/vnd.groove-tool-message': return true;// gtm
+			case 'application/vnd.groove-tool-template': return true;// tpl
+			case 'application/vnd.groove-vcard': return true;// vcg
+			case 'application/vnd.hal+xml': return true;// hal
+			case 'application/vnd.handheld-entertainment+xml': return true;// zmm
+			case 'application/vnd.hbci': return true;// hbci
+			case 'application/vnd.hhe.lesson-player': return true;// les
+			case 'application/vnd.hp-hpgl': return true;// hpgl
+			case 'application/vnd.hp-hpid': return true;// hpid
+			case 'application/vnd.hp-hps': return true;// hps
+			case 'application/vnd.hp-jlyt': return true;// jlt
+			case 'application/vnd.hp-pcl': return true;// pcl
+			case 'application/vnd.hp-pclxl': return true;// pclxl
+			case 'application/vnd.hydrostatix.sof-data': return true;// sfd- hdstx
+			case 'application/vnd.ibm.minipay': return true;// mpy
+			case 'application/vnd.ibm.modcap': return true;// afp listafp list3820
+			case 'application/vnd.ibm.rights-management': return true;// irm
+			case 'application/vnd.ibm.secure-container': return true;// sc
+			case 'application/vnd.iccprofile': return true;// icc icm
+			case 'application/vnd.igloader': return true;// igl
+			case 'application/vnd.immervision-ivp': return true;// ivp
+			case 'application/vnd.immervision-ivu': return true;// ivu
+			case 'application/vnd.insors.igm': return true;// igm
+			case 'application/vnd.intercon.formnet': return true;// xpw xpx
+			case 'application/vnd.intergeo': return true;// i2g
+			case 'application/vnd.intu.qbo': return true;// qbo
+			case 'application/vnd.intu.qfx': return true;// qfx
+			case 'application/vnd.ipunplugged.rcprofile': return true;// rcprofile
+			case 'application/vnd.irepository.package+xml': return true;// irp
+			case 'application/vnd.is-xpr': return true;// xpr
+			case 'application/vnd.isac.fcs': return true;// fcs
+			case 'application/vnd.jam': return true;// jam
+			case 'application/vnd.jcp.javame.midlet-rms': return true;// rms
+			case 'application/vnd.jisp': return true;// jisp
+			case 'application/vnd.joost.joda-archive': return true;// joda
+			case 'application/vnd.kahootz': return true;// ktz ktr
+			case 'application/vnd.kde.karbon': return true;// karbon
+			case 'application/vnd.kde.kchart': return true;// chrt
+			case 'application/vnd.kde.kformula': return true;// kfo
+			case 'application/vnd.kde.kivio': return true;// flw
+			case 'application/vnd.kde.kontour': return true;// kon
+			case 'application/vnd.kde.kpresenter': return true;// kpr kpt
+			case 'application/vnd.kde.kspread': return true;// ksp
+			case 'application/vnd.kde.kword': return true;// kwd kwt
+			case 'application/vnd.kenameaapp': return true;// htke
+			case 'application/vnd.kidspiration': return true;// kia
+			case 'application/vnd.kinar': return true;// kne knp
+			case 'application/vnd.koan': return true;// skp skd skt skm
+			case 'application/vnd.kodak-descriptor': return true;// sse
+			case 'application/vnd.las.las+xml': return true;// lasxml
+			case 'application/vnd.llamagraphics.life-balance.desktop': return true;// lbd
+			case 'application/vnd.llamagraphics.life-balance.exchange+xml': return true;// lbe
+			case 'application/vnd.lotus-1-2-3': return true;// 123
+			case 'application/vnd.lotus-approach': return true;// apr
+			case 'application/vnd.lotus-freelance': return true;// pre
+			case 'application/vnd.lotus-notes': return true;// nsf
+			case 'application/vnd.lotus-organizer': return true;// org
+			case 'application/vnd.lotus-screencam': return true;// scm
+			case 'application/vnd.lotus-wordpro': return true;// lwp
+			case 'application/vnd.macports.portpkg': return true;// portpkg
+			case 'application/vnd.mcd': return true;// mcd
+			case 'application/vnd.medcalcdata': return true;// mc1
+			case 'application/vnd.mediastation.cdkey': return true;// cdkey
+			case 'application/vnd.mfer': return true;// mwf
+			case 'application/vnd.mfmp': return true;// mfm
+			case 'application/vnd.micrografx.flo': return true;// flo
+			case 'application/vnd.micrografx.igx': return true;// igx
+			case 'application/vnd.mif': return true;// mif
+			case 'application/vnd.mobius.daf': return true;// daf
+			case 'application/vnd.mobius.dis': return true;// dis
+			case 'application/vnd.mobius.mbk': return true;// mbk
+			case 'application/vnd.mobius.mqy': return true;// mqy
+			case 'application/vnd.mobius.msl': return true;// msl
+			case 'application/vnd.mobius.plc': return true;// plc
+			case 'application/vnd.mobius.txf': return true;// txf
+			case 'application/vnd.mophun.application': return true;// mpn
+			case 'application/vnd.mophun.certificate': return true;// mpc
+			case 'application/vnd.mozilla.xul+xml': return true;// xul
+			case 'application/vnd.ms-artgalry': return true;// cil
+			case 'application/vnd.ms-cab-compressed': return true;// cab
+			case 'application/vnd.ms-excel': return true;// xls xlm xla xlc xlt xlw
+			case 'application/vnd.ms-excel.addin.macroenabled.12': return true;// xlam
+			case 'application/vnd.ms-excel.sheet.binary.macroenabled.12': return true;// xlsb
+			case 'application/vnd.ms-excel.sheet.macroenabled.12': return true;// xlsm
+			case 'application/vnd.ms-excel.template.macroenabled.12': return true;// xltm
+			case 'application/vnd.ms-fontobject': return true;// eot
+			case 'application/vnd.ms-htmlhelp': return true;// chm
+			case 'application/vnd.ms-ims': return true;// ims
+			case 'application/vnd.ms-lrm': return true;// lrm
+			case 'application/vnd.ms-office': return true;// theme thmx
+			case 'application/vnd.ms-pki.seccat': return true;// cat
+			case 'application/vnd.ms-pki.stl': return true;// stl
+			case 'application/vnd.ms-powerpoint': return true;// ppt pps pot
+			case 'application/vnd.ms-powerpoint.addin.macroenabled.12': return true;// ppam
+			case 'application/vnd.ms-powerpoint.presentation.macroenabled.12': return true;// pptm
+			case 'application/vnd.ms-powerpoint.slide.macroenabled.12': return true;// sldm
+			case 'application/vnd.ms-powerpoint.slideshow.macroenabled.12': return true;// ppsm
+			case 'application/vnd.ms-powerpoint.template.macroenabled.12': return true;// potm
+			case 'application/vnd.ms-project': return true;// mpp mpt
+			case 'application/vnd.ms-word.document.macroenabled.12': return true;// docm
+			case 'application/vnd.ms-word.template.macroenabled.12': return true;// dotm
+			case 'application/vnd.ms-works': return true;// wps wks wcm wdb
+			case 'application/vnd.ms-wpl': return true;// wpl
+			case 'application/vnd.ms-xpsdocument': return true;// xps
+			case 'application/vnd.mseq': return true;// mseq
+			case 'application/vnd.musician': return true;// mus
+			case 'application/vnd.muvee.style': return true;// msty
+			case 'application/vnd.mynfc': return true;// taglet
+			case 'application/vnd.neurolanguage.nlu': return true;// nlu
+			case 'application/vnd.nitf': return true;// ntf nitf
+			case 'application/vnd.noblenet-directory': return true;// nnd
+			case 'application/vnd.noblenet-sealer': return true;// nns
+			case 'application/vnd.noblenet-web': return true;// nnw
+			case 'application/vnd.nokia.n-gage.data': return true;// ngdat
+			case 'application/vnd.nokia.n-gage.symbian.install': return true;// n- gage
+			case 'application/vnd.nokia.radio-preset': return true;// rpst
+			case 'application/vnd.nokia.radio-presets': return true;// rpss
+			case 'application/vnd.novadigm.edm': return true;// edm
+			case 'application/vnd.novadigm.edx': return true;// edx
+			case 'application/vnd.novadigm.ext': return true;// ext
+			case 'application/vnd.oasis.opendocument.chart': return true;// odc
+			case 'application/vnd.oasis.opendocument.chart-template': return true;// otc
+			case 'application/vnd.oasis.opendocument.database': return true;// odb
+			case 'application/vnd.oasis.opendocument.formula': return true;// odf
+			case 'application/vnd.oasis.opendocument.formula-template': return true;// odft
+			case 'application/vnd.oasis.opendocument.graphics': return true;// odg
+			case 'application/vnd.oasis.opendocument.graphics-template': return true;// otg
+			case 'application/vnd.oasis.opendocument.image': return true;// odi
+			case 'application/vnd.oasis.opendocument.image-template': return true;// oti
+			case 'application/vnd.oasis.opendocument.presentation': return true;// odp
+			case 'application/vnd.oasis.opendocument.presentation-template': return true;// otp
+			case 'application/vnd.oasis.opendocument.spreadsheet': return true;// ods
+			case 'application/vnd.oasis.opendocument.spreadsheet-template': return true;// ots
+			case 'application/vnd.oasis.opendocument.text': return true;// odt
+			case 'application/vnd.oasis.opendocument.text-master': return true;// odm
+			case 'application/vnd.oasis.opendocument.text-template': return true;// ott
+			case 'application/vnd.oasis.opendocument.text-web': return true;// oth
+			case 'application/vnd.olpc-sugar': return true;// xo
+			case 'application/vnd.oma.dd2+xml': return true;// dd2
+			case 'application/vnd.openofficeorg.extension': return true;// oxt
+			case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': return true;// pptx
+			case 'application/vnd.openxmlformats-officedocument.presentationml.slide': return true;// sldx
+			case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': return true;// ppsx
+			case 'application/vnd.openxmlformats-officedocument.presentationml.template': return true;// potx
+			case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': return true;// xlsx
+			case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': return true;// xltx
+			case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': return true;// docx
+			case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': return true;// dotx
+			case 'application/vnd.osgeo.mapguide.package': return true;// mgp
+			case 'application/vnd.osgi.dp': return true;// dp
+			case 'application/vnd.osgi.subsystem': return true;// esa
+			case 'application/vnd.palm': return true;// pdb pqa oprc
+			case 'application/vnd.pawaafile': return true;// paw
+			case 'application/vnd.pg.format': return true;// str
+			case 'application/vnd.pg.osasli': return true;// ei6
+			case 'application/vnd.picsel': return true;// efif
+			case 'application/vnd.pmi.widget': return true;// wg
+			case 'application/vnd.pocketlearn': return true;// plf
+			case 'application/vnd.powerbuilder6': return true;// pbd
+			case 'application/vnd.previewsystems.box': return true;// box
+			case 'application/vnd.proteus.magazine': return true;// mgz
+			case 'application/vnd.publishare-delta-tree': return true;// qps
+			case 'application/vnd.pvi.ptid1': return true;// ptid
+			case 'application/vnd.quark.quarkxpress': return true;// qxd qxt qwd qwt qxl qxb
+			case 'application/vnd.realvnc.bed': return true;// bed
+			case 'application/vnd.recordare.musicxml': return true;// mxl
+			case 'application/vnd.recordare.musicxml+xml': return true;// musicxml
+			case 'application/vnd.rig.cryptonote': return true;// cryptonote
+			case 'application/vnd.rim.cod': return true;// cod
+			case 'application/vnd.rn-realmedia': return true;// rm
+			case 'application/vnd.rn-realmedia-vbr': return true;// rmvb
+			case 'application/vnd.route66.link66+xml': return true;// link66
+			case 'application/vnd.sailingtracker.track': return true;// st
+			case 'application/vnd.seemail': return true;// see
+			case 'application/vnd.sema': return true;// sema
+			case 'application/vnd.semd': return true;// semd
+			case 'application/vnd.semf': return true;// semf
+			case 'application/vnd.shana.informed.formdata': return true;// ifm
+			case 'application/vnd.shana.informed.formtemplate': return true;// itp
+			case 'application/vnd.shana.informed.interchange': return true;// iif
+			case 'application/vnd.shana.informed.package': return true;// ipk
+			case 'application/vnd.simtech-mindmapper': return true;// twd twds
+			case 'application/vnd.smaf': return true;// mmf
+			case 'application/vnd.smart.teacher': return true;// teacher
+			case 'application/vnd.solent.sdkm+xml': return true;// sdkm sdkd
+			case 'application/vnd.spotfire.dxp': return true;// dxp
+			case 'application/vnd.spotfire.sfs': return true;// sfs
+			case 'application/vnd.stardivision.calc': return true;// sdc
+			case 'application/vnd.stardivision.draw': return true;// sda
+			case 'application/vnd.stardivision.impress': return true;// sdd
+			case 'application/vnd.stardivision.math': return true;// smf
+			case 'application/vnd.stardivision.writer': return true;// sdw vor
+			case 'application/vnd.stardivision.writer-global': return true;// sgl
+			case 'application/vnd.stepmania.package': return true;// smzip
+			case 'application/vnd.stepmania.stepchart': return true;// sm
+			case 'application/vnd.sun.xml.calc': return true;// sxc
+			case 'application/vnd.sun.xml.calc.template': return true;// stc
+			case 'application/vnd.sun.xml.draw': return true;// sxd
+			case 'application/vnd.sun.xml.draw.template': return true;// std
+			case 'application/vnd.sun.xml.impress': return true;// sxi
+			case 'application/vnd.sun.xml.impress.template': return true;// sti
+			case 'application/vnd.sun.xml.math': return true;// sxm
+			case 'application/vnd.sun.xml.writer': return true;// sxw
+			case 'application/vnd.sun.xml.writer.global': return true;// sxg
+			case 'application/vnd.sun.xml.writer.template': return true;// stw
+			case 'application/vnd.sus-calendar': return true;// sus susp
+			case 'application/vnd.svd': return true;// svd
+			case 'application/vnd.symbian.install			sis': return true;// sisx
+			case 'application/vnd.syncml+xml': return true;// xsm
+			case 'application/vnd.syncml.dm+wbxml': return true;// bdm
+			case 'application/vnd.syncml.dm+xml': return true;// xdm
+			case 'application/vnd.tao.intent-module-archive': return true;// tao
+			case 'application/vnd.tcpdump.pcap': return true;// pcap cap dmp
+			case 'application/vnd.tmobile-livetv': return true;// tmo
+			case 'application/vnd.trid.tpt': return true;// tpt
+			case 'application/vnd.triscape.mxs': return true;// mxs
+			case 'application/vnd.trueapp': return true;// tra
+			case 'application/vnd.ufdl': return true;// ufd ufdl
+			case 'application/vnd.uiq.theme': return true;// utz
+			case 'application/vnd.umajin': return true;// umj
+			case 'application/vnd.unity': return true;// unityweb
+			case 'application/vnd.uoml+xml': return true;// uoml
+			case 'application/vnd.vcx': return true;// vcx
+			case 'application/vnd.visio': return true;// vsd vst vss vsw
+			case 'application/vnd.visionary': return true;// vis
+			case 'application/vnd.vsf': return true;// vsf
+			case 'application/vnd.wap.wbxml': return true;// wbxml
+			case 'application/vnd.wap.wmlc': return true;// wmlc
+			case 'application/vnd.wap.wmlscriptc': return true;// wmlsc
+			case 'application/vnd.webturbo': return true;// wtb
+			case 'application/vnd.wolfram.player': return true;// nbp
+			case 'application/vnd.wordperfect': return true;// wpd
+			case 'application/vnd.wqd': return true;// wqd
+			case 'application/vnd.wt.stf': return true;// stf
+			case 'application/vnd.xara': return true;// xar
+			case 'application/vnd.xfdl': return true;// xfdl
+			case 'application/vnd.yamaha.hv-dic': return true;// hvd
+			case 'application/vnd.yamaha.hv-script': return true;// hvs
+			case 'application/vnd.yamaha.hv-voice': return true;// hvp
+			case 'application/vnd.yamaha.openscoreformat': return true;// osf
+			case 'application/vnd.yamaha.openscoreformat.osfpvg+xml': return true;// osfpvg
+			case 'application/vnd.yamaha.smaf-audio': return true;// saf
+			case 'application/vnd.yamaha.smaf-phrase': return true;// spf
+			case 'application/vnd.yellowriver-custom-menu': return true;// cmp
+			case 'application/vnd.zul': return true;// zir zirz
+			case 'application/vnd.zzazz.deck+xml': return true;// zaz
+			case 'application/voicexml+xml': return true;// vxml
+			case 'application/widget': return true;// wgt
+			case 'application/winhlp': return true;// hlp
+			case 'application/wsdl+xml': return true;// wsdl
+			case 'application/wspolicy+xml': return true;// wspolicy
+			case 'application/x-7z-compressed': return true;// 7z
+			case 'application/x-abiword': return true;// abw
+			case 'application/x-ace-compressed': return true;// ace
+			case 'application/x-apple-diskimage': return true;// dmg
+			case 'application/x-authorware-bin': return true;// aab x32 u32 vox
+			case 'application/x-authorware-map': return true;// aam
+			case 'application/x-authorware-seg': return true;// aas
+			case 'application/x-archive': return true;// ADMIN_USERS//5027.Pawel_Kamola/projekty/grafy_projekt_python/grafy/numpy/core/lib/libnpymath.a
+			case 'application/x-empty': return false;// empty files
+			case 'application/x-bcpio': return true;// bcpio
+			case 'application/x-bittorrent': return true;// torrent
+			case 'application/x-blorb': return true;// blb blorb
+			case 'application/x-bzip': return true;// bz
+			case 'application/x-bzip2': return true;// bz2 boz
+			case 'application/x-cbr': return true;// cbr cba cbt cbz cb7
+			case 'application/x-cdlink': return true;// vcd
+			case 'application/x-cfs-compressed': return true;// cfs
+			case 'application/x-chat': return true;// chat
+			case 'application/x-chess-pgn': return true;// pgn
+			case 'application/x-conference': return true;// nsc
+			case 'application/x-cpio': return true;// cpio
+			case 'application/x-csh': return true;// csh
+			case 'application/x-debian-package': return true;// deb udeb
+			case 'application/x-dgc-compressed': return true;// dgc
+			case 'application/x-director': return true;// dir dcr dxr cst cct cxt w3d fgd swa
+			case 'application/x-doom': return true;// wad
+			case 'application/x-dtbncx+xml': return true;// ncx
+			case 'application/x-dtbook+xml': return true;// dtb
+			case 'application/x-dtbresource+xml': return true;// res
+			case 'application/x-dvi': return true;// dvi
+			case 'application/x-envoy': return true;// evy
+			case 'application/x-eva': return true;// eva
+			case 'application/x-font-bdf': return true;// bdf
+			case 'application/x-font-ghostscript': return true;// gsf
+			case 'application/x-font-linux-psf': return true;// psf
+			case 'application/x-font-otf': return true;// otf
+			case 'application/x-font-pcf': return true;// pcf
+			case 'application/x-font-snf': return true;// snf
+			case 'application/x-font-ttf': return true;// ttc ttf
+			case 'application/x-font-type1': return true;// afm pfa pfb pfm
+			case 'application/x-freearc': return true;// arc
+			case 'application/x-futuresplash': return true;// spl
+			case 'application/x-executable': return true;//
+			case 'application/x-gca-compressed': return true;// gca
+			case 'application/x-glulx': return true;// ulx
+			case 'application/x-gnumeric': return true;// gnumeric
+			case 'application/x-gramps-xml': return true;// gramps
+			case 'application/x-gtar': return true;// gtar
+			case 'application/x-gzip': return true;// gz gzip
+			case 'application/x-hdf': return true;// hdf
+			case 'application/x-install-instructions': return true;// install
+			case 'application/x-iso9660-image': return true;// iso
+			case 'application/x-java-jnlp-file': return true;// jnlp
+			case 'application/x-latex': return true;// latex
+			case 'application/x-lzh-compressed': return true;// lha lzh
+			case 'application/x-mie': return true;// mie
+			case 'application/x-mobipocket-ebook': return true;// mobi prc
+			case 'application/x-ms-application': return true;// application
+			case 'application/x-ms-shortcut': return true;// lnk
+			case 'application/x-ms-wmd': return true;// wmd
+			case 'application/x-ms-wmz': return true;// wmz
+			case 'application/x-ms-xbap': return true;// xbap
+			case 'application/x-msaccess': return true;// mdb
+			case 'application/x-msbinder': return true;// obd
+			case 'application/x-mscardfile': return true;// crd
+			case 'application/x-msclip': return true;// clp
+			case 'application/x-msdownload': return true;// msi exe dll com bat
+			case 'application/x-msmediaview': return true;// m14 mvb m13
+			case 'application/x-msmetafile': return true;// emz wmf wmz emf
+			case 'application/x-msmoney': return true;// mny
+			case 'application/x-mspublisher': return true;// pub
+			case 'application/x-msschedule': return true;// scd
+			case 'application/x-msterminal': return true;// trm
+			case 'application/x-mswrite': return true;// wri
+			case 'application/x-netcdf': return true;// cdf nc
+			case 'application/x-nzb': return true;// nzb
+			case 'application/x-pkcs12': return true;// pfx p12
+			case 'application/x-pkcs7-certificates': return true;// spc p7b
+			case 'application/x-pkcs7-certreqresp': return true;// p7r
+			case 'application/x-rar': return true;// rar
+			case 'application/x-rar-compressed': return true;// rar
+			case 'application/x-research-info-systems': return true;// ris
+			case 'application/x-sh': return true;// sh
+			case 'application/x-shar': return true;// shar
+			case 'application/x-shockwave-flash': return true;// swf
+			case 'application/x-silverlight-app': return true;// xap
+			case 'application/x-sql': return true;// sql
+			case 'application/x-stuffit': return true;// sit
+			case 'application/x-stuffitx': return true;// sitx
+			case 'application/x-subrip': return true;// srt
+			case 'application/x-sv4cpio': return true;// sv4cpio
+			case 'application/x-sv4crc': return true;// sv4crc
+			case 'application/x-t3vm-image': return true;// t3
+			case 'application/x-tads': return true;// gam
+			case 'application/x-tar': return true;// tar
+			case 'application/x-tcl': return true;// tcl
+			case 'application/x-tex': return true;// tex
+			case 'application/x-tex-tfm': return true;// tfm
+			case 'application/x-texinfo': return true;// texi texinfo
+			case 'application/x-tgif': return true;// obj
+			case 'application/x-ustar': return true;// ustar
+			case 'application/x-wais-source': return true;// src
+			case 'application/x-x509-ca-cert': return true;// crt der
+			case 'application/x-xfig': return true;// fig
+			case 'application/x-xliff+xml': return true;// xlf
+			case 'application/x-xpinstall': return true;// xpi
+			case 'application/x-xz': return true;// xz
+			case 'application/x-zmachine': return true;// z8 z1 z2 z3 z4 z5 z6 z7
+			case 'application/xaml+xml': return true;// xaml
+			case 'application/xcap-diff+xml': return true;// xdf
+			case 'application/xenc+xml': return true;// xenc
+			case 'application/xhtml+xml': return true;// xht xhtml
+			case 'application/xml': return true;// xsl xml
+			case 'application/xml-dtd': return true;// dtd
+			case 'application/xop+xml': return true;// xop
+			case 'application/xproc+xml': return true;// xpl
+			case 'application/xslt+xml': return true;// xslt
+			case 'application/xspf+xml': return true;// xspf
+			case 'application/xv+xml': return true;// xvm mxml xhvml xvml
+			case 'application/yang': return true;// yang
+			case 'application/yin+xml': return true;// yin
+			case 'application/zip': return true;// zip
+			case 'audio/adpcm': return true;// adp
+			case 'audio/basic': return true;// snd au
+			case 'audio/midi': return true;// rmi mid midi kar
+			case 'audio/mp4': return true;// mp4a m4a
+			case 'audio/mpeg': return true;// m3a mpga mp2 mp2a mp3 m2a
+			case 'audio/ogg': return true;// spx oga ogg
+			case 'audio/s3m': return true;// s3m
+			case 'audio/silk': return true;// sil
+			case 'audio/vnd.dece.audio': return true;// uvva uva
+			case 'audio/vnd.digital-winds': return true;// eol
+			case 'audio/vnd.dra': return true;// dra
+			case 'audio/vnd.dts': return true;// dts
+			case 'audio/vnd.dts.hd': return true;// dtshd
+			case 'audio/vnd.lucent.voice': return true;// lvp
+			case 'audio/vnd.ms-playready.media.pya': return true;// pya
+			case 'audio/vnd.nuera.ecelp4800': return true;// ecelp4800
+			case 'audio/vnd.nuera.ecelp7470': return true;// ecelp7470
+			case 'audio/vnd.nuera.ecelp9600': return true;// ecelp9600
+			case 'audio/vnd.rip': return true;// rip
+			case 'audio/webm': return true;// weba
+			case 'audio/x-aac': return true;// aac
+			case 'audio/x-aiff': return true;// aifc aif aiff
+			case 'audio/x-caf': return true;// caf
+			case 'audio/x-flac': return true;// flac
+			case 'audio/x-matroska': return true;// mka
+			case 'audio/x-mpegurl': return true;// m3u
+			case 'audio/x-ms-wax': return true;// wax
+			case 'audio/x-ms-wma': return true;// wma
+			case 'audio/x-pn-realaudio': return true;// ra ram
+			case 'audio/x-pn-realaudio-plugin': return true;// rmp
+			case 'audio/x-wav': return true;// wav
+			case 'audio/xm': return true;// xm
+			case 'chemical/x-cdx': return true;// cdx
+			case 'chemical/x-cif': return true;// cif
+			case 'chemical/x-cmdf': return true;// cmdf
+			case 'chemical/x-cml': return true;// cml
+			case 'chemical/x-csml': return true;// csml
+			case 'chemical/x-xyz': return true;// xyz
+			case 'image/bmp': return true;// bmp
+			case 'image/cgm': return true;// cgm
+			case 'image/g3fax': return true;// g3
+			case 'image/gif': return true;// gif
+			case 'image/ief': return true;// ief
+			case 'image/jpeg': return true;// jpe jpeg jpg
+			case 'image/ktx': return true;// ktx
+			case 'image/png': return true;// png
+			case 'image/prs.btif': return true;// btif
+			case 'image/sgi': return true;// sgi
+			case 'image/svg+xml': return true;// svgz svg
+			case 'image/tiff': return true;// tif tiff
+			case 'image/vnd.adobe.photoshop': return true;// psd
+			case 'image/vnd.dece.graphic': return true;// uvvg uvi uvvi uvg
+			case 'image/vnd.djvu': return true;// djv djvu
+			case 'image/vnd.dvb.subtitle': return true;// sub
+			case 'image/vnd.dwg': return true;// dwg
+			case 'image/vnd.dxf': return true;// dxf
+			case 'image/vnd.fastbidsheet': return true;// fbs
+			case 'image/vnd.fpx': return true;// fpx
+			case 'image/vnd.fst': return true;// fst
+			case 'image/vnd.fujixerox.edmics-mmr': return true;// mmr
+			case 'image/vnd.fujixerox.edmics-rlc': return true;// rlc
+			case 'image/vnd.ms-modi': return true;// mdi
+			case 'image/vnd.ms-photo': return true;// wdp
+			case 'image/vnd.net-fpx': return true;// npx
+			case 'image/vnd.wap.wbmp': return true;// wbmp
+			case 'image/vnd.xiff': return true;// xif
+			case 'image/webp': return true;// webp
+			case 'image/x-3ds': return true;// 3ds
+			case 'image/x-cmu-raster': return true;// ras
+			case 'image/x-cmx': return true;// cmx
+			case 'image/x-freehand': return true;// fh7 fh fhc fh4 fh5
+			case 'image/x-ico': return true;// ico
+			case 'image/x-icon': return true;// ico
+			case 'image/x-mrsid-image': return true;// sid
+			case 'image/x-ms-bmp': return true;// bmp
+			case 'image/x-pcx': return true;// pcx
+			case 'image/x-pict': return true;// pct pic
+			case 'image/x-portable-anymap': return true;// pnm
+			case 'image/x-portable-bitmap': return true;// pbm
+			case 'image/x-portable-graymap': return true;// pgm
+			case 'image/x-portable-greymap': return true;// pgm
+			case 'image/x-portable-pixmap': return true;// ppm
+			case 'image/x-rgb': return true;// rgb
+			case 'image/x-tga': return true;// tga
+			case 'image/x-xbitmap': return true;// xbm
+			case 'image/x-xpixmap': return true;// xpm
+			case 'image/x-xwindowdump': return true;// xwd
+			case 'message/rfc822': return true;// mime eml
+			case 'model/iges': return true;// iges igs
+			case 'model/mesh': return true;// silo msh mesh
+			case 'model/vnd.collada+xml': return true;// dae
+			case 'model/vnd.dwf': return true;// dwf
+			case 'model/vnd.gdl': return true;// gdl
+			case 'model/vnd.gtw': return true;// gtw
+			case 'model/vnd.mts': return true;// mts
+			case 'model/vnd.vtu': return true;// vtu
+			case 'model/vrml': return true;// vrml wrl
+			case 'model/x3d+binary': return true;// x3dbz x3db
+			case 'model/x3d+vrml': return true;// x3dvz x3dv
+			case 'model/x3d+xml': return true;// x3dz x3d
+			case 'text/cache-manifest': return true;// appcache
+			case 'text/calendar': return true;// ifb ics
+			case 'text/css': return true;// css
+			case 'text/csv': return true;// csv
+			case 'text/html': return true;// htm html
+			case 'text/n3': return true;// n3
+			case 'text/plain': return true;// in txt text conf def list log
+			case 'text/prs.lines.tag': return true;// dsc
+			case 'text/rtf': return true;// rtf
+			case 'text/richtext': return true;// rtx
+			case 'text/sgml': return true;// sgm sgml
+			case 'text/tab-separated-values': return true;// tsv
+			case 'text/troff': return true;// ms t tr roff man me
+			case 'text/turtle': return true;// ttl
+			case 'text/uri-list': return true;// urls uri uris
+			case 'text/vcard': return true;// vcard
+			case 'text/vnd.curl': return true;// curl
+			case 'text/vnd.curl.dcurl': return true;// dcurl
+			case 'text/vnd.curl.mcurl': return true;// mcurl
+			case 'text/vnd.curl.scurl': return true;// scurl
+			case 'text/vnd.dvb.subtitle': return true;// sub
+			case 'text/vnd.fly': return true;// fly
+			case 'text/vnd.fmi.flexstor': return true;// flx
+			case 'text/vnd.graphviz': return true;// gv
+			case 'text/vnd.in3d.3dml': return true;// 3dml
+			case 'text/vnd.in3d.spot': return true;// spot
+			case 'text/vnd.sun.j2me.app-descriptor': return true;// jad
+			case 'text/vnd.wap.wml': return true;// wml
+			case 'text/vnd.wap.wmlscript': return true;// wmls
+			case 'text/x-asm': return true;// s asm
+			case 'text/x-c': return true;// c cc cxx cpp h hh dic
+			case 'text/x-c++': return true;// c++
+			case 'text/x-fortran': return true;// f for f77 f90
+			case 'text/x-java': return true;// java
+			case 'text/x-java-source': return true;// java
+			case 'text/x-makefile': return true;// Makefile
+			case 'text/x-nfo': return true;// nfo
+			case 'text/x-opml': return true;// opml
+			case 'text/x-pascal': return true;// p pas
+			case 'text/x-php': return true;// php
+			case 'text/x-python': return true;// py
+			case 'text/x-setext': return true;// etx
+			case 'text/x-sfv': return true;// sfv
+			case 'text/x-shellscript': return true;// ...
+			case 'text/x-uuencode': return true;// uu
+			case 'text/x-vcalendar': return true;// vcs
+			case 'text/x-vcard': return true;// vcf
+			case 'video/3gpp': return true;// 3gp
+			case 'video/3gpp2': return true;// 3g2
+			case 'video/h261': return true;// h261
+			case 'video/h263': return true;// h263
+			case 'video/h264': return true;// h264
+			case 'video/jpeg': return true;// jpgv
+			case 'video/jpm': return true;// jpm jpgm
+			case 'video/mj2': return true;// mjp2 mj2
+			case 'video/mp4': return true;// mpg4 mp4 mp4v
+			case 'video/mpeg': return true;// m2v mpeg mpg mpe m1v
+			case 'video/ogg': return true;// ogv
+			case 'video/quicktime': return true;// mov qt
+			case 'video/vnd.dece.hd': return true;// uvvh uvh
+			case 'video/vnd.dece.mobile': return true;// uvvm uvm
+			case 'video/vnd.dece.pd': return true;// uvvp uvp
+			case 'video/vnd.dece.sd': return true;// uvvs uvs
+			case 'video/vnd.dece.video': return true;// uvvv uvv
+			case 'video/vnd.dvb.file': return true;// dvb
+			case 'video/vnd.fvt': return true;// fvt
+			case 'video/vnd.mpegurl': return true;// m4u mxu
+			case 'video/vnd.ms-playready.media.pyv': return true;// pyv
+			case 'video/vnd.uvvu.mp4': return true;// uvvu uvu
+			case 'video/vnd.vivo': return true;// viv
+			case 'video/webm': return true;// webm
+			case 'video/x-f4v': return true;// f4v
+			case 'video/x-fli': return true;// fli
+			case 'video/x-flv': return true;// flv
+			case 'video/x-m4v': return true;// m4v
+			case 'video/x-matroska': return true;// mks mkv mk3d
+			case 'video/x-mng': return true;// mng
+			case 'video/x-ms-asf': return true;// asx asf
+			case 'video/x-ms-vob': return true;// vob
+			case 'video/x-ms-wm': return true;// wm
+			case 'video/x-ms-wmv': return true;// wmv
+			case 'video/x-ms-wmx': return true;// wmx
+			case 'video/x-ms-wvx': return true;// wvx
+			case 'video/x-msvideo': return true;// avi
+			case 'video/x-sgi-movie': return true;// movie
+			case 'video/x-smv': return true;// smv
+			case 'x-conference/x-cooltalk': return true;// ice
+		}
+		return false;
+	}
+
 }
 }