UNPKG

wiz-frameworks

Version:

wizlong react framework

23 lines (21 loc) 1.08 kB
/** * 根据类型确定文件归档文件夹 */ var getCustomDirByType = function getCustomDirByType(type) { var t = 'other/'; if (new RegExp("image/.*").test(type)) { t = 'picture/'; } else if (new RegExp("audio/.*|video/.*").test(type)) { t = 'media/'; } else if (new RegExp("application/msword|application/vnd.openxmlformatsofficedocument.wordprocessingml.document|application/vnd.openxmlformats-officedocument.wordprocessingml.document").test(type)) { t = 'doc/'; } else if (new RegExp("application/vnd.msexcel|application/vnd.openxmlformatsofficedocument.spreadsheetml.sheet|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/vnd.ms-excel").test(type)) { t = 'excel/'; } else if (new RegExp("application/vnd.ms-powerpoint|application/vnd.mspowerpoint|application/vnd.openxmlformatsofficedocument.presentationml.presentation").test(type)) { t = 'ppt/'; } else if (new RegExp("application/pdf").test(type)) { t = 'pdf/'; } return t; }; export { getCustomDirByType };