1π
β
I donβt understand the problem but as I can see you use the same formData object for every call. I think you should initialize FormData in the loop, it can cause strange cases.
By the way, I think you can submit multiple files in one axios call too:
postitem() {
let formData = new FormData();
for (var i = 0; i < this.file.length; i++) {
var obj = this.file[i];
formData.append("filename[]", obj);
}
axios.post(`url/test/postimages`, formData, {
headers: { Authorization: `Bearer ${token()}`,
'Content-Type': 'multipart/form-data' },
}).then((response) => {
if (response.status === "error") {
alert("error");
this.loading = false;
} else {
alert("success");
}
});
},
Source:stackexchange.com