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) {
     /*這裏作處理*/
    }
 })
}
相關文章
相關標籤/搜索