二開時增加了批量上傳導入商品,上傳excel時獲取不到文件
$_FILES 同樣是空的
前端代碼
postfile() {
if (this.file === ''){
this.$notify.error({
title: "錯誤",
message: "上傳文件不能為空"
})
return false
} else {
console.log(this.file)
let formData = new FormData()
formData.append('file',this.file)
this.btn.disable = true
this.btn.message = "正在導入,請等待"
importExcelApi(formData).then(res => {
console.log(res.message)
})
}
},
這里打印file是正確的值
我在接收文件代碼里直接
return app('json')->success($_FILES);
返回值是空的,用框架的 $this->request->file()同樣獲取不到
求助支個招