Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

284
Views
¿Por qué no puedo enviar varios archivos con texto diferente usando ajax o fetsh apiin javascript?

este es mi codigo

 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)) })

en este código, estaba tratando de enviar múltiples imágenes con muchos objetos json al servidor, pero el servidor devolvió el error 308

permite enviar una imagen con un objeto json diferente pero con muchos archivos o imágenes devuelve ese error;

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!