首页 > 基于 HTML5 的上传组件如何过滤文件类型?

基于 HTML5 的上传组件如何过滤文件类型?

如果我在页面中要这样调用

$('#test').html5Upload(function() {
  ……
  accept: ['png', 'jpg', 'gif', 'word', '……']
  ……
});

其中上传的文件得到的格式有很多

image/*
text/html, text/plan, text/……
application/pdf, application/msword, application/……

那我组件中的 js 过滤应该是怎么样来写呢?无思路,请教!


具体是什么组件?
html5可以直接实现文件类型过滤

html<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
【热门文章】
【热门文章】