Level 56
This might help:
https://medium.com/@JackPu/json-data-to-formdata-7341def7fc3c
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
characteristics: { one: { "character1": "value1", "character2": "value2", "colors": [ { "1": { "name": "red", "files":[{},{}] //Multiple Images } }, { "2": { "name": "blue", "files": [{},{}] //Multiple Images } } ] }, two: { "1": 1000, "2": 3000 }, three: { "description": "sdsds", "additional": [ { "additional1": "value1", "additional2": "value2" } ] } }
submitForm() {
let formData = new FormData();
for (const formDataKey in this.characteristics["one"]["colors"]) {
console.log(formDataKey)
formData.append(formDataKey, this.file);
////????????????? }
this.axios.post('http://localhost:8000/api/product',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
).then(function (data) {
console.log(data.data);
})
.catch(function () {
console.log('FAILURE!!');
});
},
onChangeFileUpload() {
this.file = this.$refs.file.files[0];
}
Please or to participate in this conversation.