基本信息
源码名称:easyUpload多文件上传 示例源码
源码大小:0.08M
文件格式:.zip
开发语言:js
更新时间:2018-09-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>easyUpload.js</title>
  <link rel="stylesheet" href="easy-upload.css">
  <style>
    html{
      /* background: #f5f5f5; */
      background: #fff;
    }
  </style>
</head>
<body>
  <div id="easyContainer"></div>
 <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
  <!-- 视实际需要决定是否引入jquery.cookie-1.4.1.min.js-->
  <script src="vendor/jquery.cookie-1.4.1.min.js"></script>
  <script src="easyUpload.js"></script>
  <script>
    $('#easyContainer').easyUpload({
      allowFileTypes: '*.jpg;*.doc;*.pdf',//允许上传文件类型,格式';*.doc;*.pdf'
      allowFileSize: 100000,//允许上传文件大小(KB)
      selectText: '选择文件',//选择文件按钮文案
      multi: true,//是否允许多文件上传
      multiNum: 5,//多文件上传时允许的文件数
      showNote: true,//是否展示文件上传说明
      note: '提示:最多上传5个文件,支持格式为doc、pdf、jpg',//文件上传说明
      showPreview: true,//是否显示文件预览
      url: '/api/file/upload',//上传文件地址
      fileName: 'file',//文件filename配置参数
      formParam: {
        token: $.cookie('token_cookie')//不需要验证token时可以去掉
      },//文件filename以外的配置参数,格式:{key1:value1,key2:value2}
      timeout: 30000,//请求超时时间
      okCode: 200,//与后端返回数据code值一致时执行成功回调,不配置默认200
      successFunc: function(res) {
        console.log('成功回调', res);
      },//上传成功回调函数
      errorFunc: function(res) {
        console.log('失败回调', res);
      },//上传失败回调函数
      deleteFunc: function(res) {
        console.log('删除回调', res);
      }//删除文件回调函数
    });
  </script>
</body>
</html>