vue + axios + formdata 上傳文件帶參數的爬坑之路 ...
submitForm(event) {
let formData = new FormData()
formData.append('name', this.name)
formData.append('age', this.age)
formData.append('file', this.file)
let config = {
headers: {
'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime()
}
}
this.$http.post('/myupload', formData, config).then(function (res) {
if (res.status === 2000) {
/*這裡做處理*/
}
})
}