Last active
August 29, 2015 14:13
-
-
Save foru17/3d9e3a4693444fac2444 to your computer and use it in GitHub Desktop.
几个进行文件操作的js方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//判断文件类型 | |
function checkFileType(file) { | |
allowedDocTypes = ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]; | |
if (file.type.indexOf("image/") == 0) { | |
return "image" | |
} else if (allowedDocTypes.indexOf(file.type) > -1) { | |
return "doc" | |
} | |
return false | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment