@PostMapping(value = "/admin/item/new", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
public ItemNewResponse itemNew(@RequestParam(value = "itemImgFile") List<MultipartFile> files ) {
...
As a result of running Postman, there is no problem with the backend.
Front-End ...
const formData = new FormData();
for(let i = 0; i < this.upload.length; i++) {
formData.append('itemImgFile', this.upload[i])
}
axios.post("admin/item/new", formData, {
headers: {
'Content-Type': 'multipart/form-data',
'Access-Control-Allow-Origin': '*',
},
withCredentials: true
}).then(({data}) => {
state.errorMessage = data.errorMessage;
if (state.errorMessage != null) {
alert(state.errorMessage);
}
...
I don't know what's wrong with vue.