【发布时间】:2018-10-11 05:20:50
【问题描述】:
我想将多个图像文件发布到服务器。我使用了 formData (formDta.append()),它只得到一张图像。它没有拍摄多张图片
**#contained-button-file** is the input file ID
uploadCategoryImages = () => {
let formData = new FormData()
let imagefile = document.querySelector('#contained-button-file')
formData.append('image', imagefile.files[0])
api.post('/api/v1/addimage/category/3', formData)
.then(function (response) {
console.log(response)
})
.catch(function (error) {
alert(error)
})
}
【问题讨论】:
标签: javascript reactjs form-data