# 3.el-upload多文件上传

1.多文件上传分为单文件、多文件接口单文件、多文件同一接口上传,后台接口配置见node-->koa2 实现文件上传

el-upload上传多文件默认多次调用接口,只调用一次接口可自定义http-request,前端关键代码如下,具体代码见upload.vue(opens new window) 参考链接(opens new window)

<script>
export default{
  methods: {
    // 多文件上传的时候,有多少个文件就会执行多少次customHttpRequest
    customHttpRequest(file){
      // append files还是file与后台协商
      // this.fileData.append('files',file.file)
      this.fileData.append('file',file.file)
    }
  },
</script>