this my code
articleForm.addEventListener('submit', (e)=>{
e.preventDefault()
var formData = new FormData() // create a new form data
var article = []
for (const element of editor_box.children){
article.push(getElement(element))
}
article.push({'imagesNumber': JSON.stringify(allFiles.length)})
formData.append('article', JSON.stringify(article))
if (allFiles){
for(var i=0; i<=allFiles.length-1; i++){
formData.append(`file_${i}`, allFiles[i], allFiles[i].name)
}
}
console.log(allFiles)
// post the article to the server
const endpoint = '/only-admin/article/upload'
const req = new XMLHttpRequest()
req.addEventListener('readystatechange', ()=>{
if(req.status == 200 && req.readyState == 4){
console.log(JSON.parse(req.responseText).res)
}
})
req.open('POST', endpoint, true)
req.send(formData)
// fetch(endpoint, {
// method: 'POST',
// body: formData
// })
// .then(res=> res.json())
// .then(text => console.log(text.res))
})
in this code i was trying to send multiple images with many json object to the server but the server return 308 error
the it allows to send one image with different json object but with there is many file or images it return that error;