curl -X POST "http://localhost:9090/knowledge/books/saveOrUpdate?agency=aa&bookName=aa&pubTime=2023-08-07®ion=bb" -H "accept: */*" -H "Content-Type: multipart/form-data" -F "cover=@tu.png;type=image/png" -F "file=@jr.epub;type=application/epub"
上传文件哦,文件作为formdata上传
if (valid) {
const formData = new FormData();
console.log(bookFile.value,coverFile.value)
if (bookFile.value) {
formData.append("file", bookFile.value);
}
if (coverFile.value) {
formData.append("cover", coverFile.value);
}
const url = `/api/knowledge/books/saveOrUpdate?agency=${uploadBookForm.agency}&bookName=${uploadBookForm.bookName}&pubTime=${uploadBookForm.pubTime}®ion=${uploadBookForm.region}`;
console.log("formData", formData);
axios.post(url, formData)
.then(response => {
console.log("await response", response.data);
})
.catch(error => {
console.error("Error during the request:", error);
});
} else {
console.log('error submit!', fields);
}
帮我看看有什么常识性基础问题吗
我在后端给的网址传是成功的200,我在自己写总是500,get数据什么没问题的
后端问题,加文件上传问题