Hello guys I am working on a laravel project that requires user to submit data with files in a page. There are multiple form will be submitted at once when user click submit, I am using formData to separate the files and other normal input when submit
const formData = new FormData();
for (var key in this.equipments) {
formData.append('id_'+key, JSON.stringify(this.equipments[key]));
}
this.equipments.forEach((item, idx) => {
formData.append("file_" + idx, item.New_Cert);
});
axios
.post("/equipments/calibration", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
This is the output I getting in my backend with request->all()

May I ask how can I separate this request array into two based on the key value? Currently the array structure is like
[
"id_0" => ".."
"id_1" => ".."
....
"file_0" =>"..."
"file_1"=>""...."
....
]
can I divide it into two array so that I will have
id array
[ "id_0"=>"", "id_1"=>"", ... ]
file array
[ "file_0"=>"", "file_1"=>"", .. ]