如何在上传多张图片时获得响应

How to get response while uploading multiple images

当我上传多张图片时,我一直在努力获得回复 images.The API 应该会给我一些回复。(但是,在上传单张图片时,我得到了有效响应。)这是代码:

fileChangedHandler = (event) => {
    const {files} = this.state
    this.setState({ files: [...files, ...event.target.files] })
    const uploaders = files.map(file=>{
        let data = new FormData()
        data.append('image',file)
        return  axios.post('/web/v1.0/upload',data,{
            onUploadProgress: function (progressEvent) {
              console.log(Math.floor((progressEvent.loaded * 100) / progressEvent.total));}
            }).then(response=>{
            console.log(response.data)
        }).catch(error=>{
            console.log(error.response.data)
        })
    })
    axios.all(uploaders).then(() => {

        console.log("All images uploaded")
      });
  } 

我刚刚在控制台中收到 "All images uploaded"。

尝试将响应变量放入回调中。

axios.all(uploaders).then((response) => {

 console.log("All images uploaded", response)

});

理想情况下,response 应该是一个字符串数组。