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

224
Views
JS POST Payload: debe especificar el campo de datos del formulario `fuente` o `archivo`

Por alguna razón, esto funciona bien en Postman cuando selecciono manualmente un archivo de mi PC para cargarlo, pero cuando trato de ejecutarlo en producción desde un formulario web en mi sitio web, recibo una respuesta 400 con el mensaje "Tiene que especificar la source o file campo de datos del formulario".

¿Qué está mal con este código? Esto es palabra por palabra del menú "código" del cartero y debería reflejar la solicitud exitosa que puedo enviar desde el cartero.

//Interfaz

 <input type="file" id="physical" name="physical" value="" placeholder="Click or drag a file to this area to upload." data-size="20">

// Extremo posterior

 var physicalUpload = document.getElementById("physical").files[0]; headers = {'Authorization': 'API-Key xxxxxxxxxxx','Content-Type': 'multipart/form-data'}; //Create attachment var formdata = new FormData(); formdata.append("file",physicalUpload); var requestOptions = { method: 'POST', headers: headers, body: formdata, redirect: 'follow' }; let response = await fetch("https://api.xxxxxxx.com/public/v1/documents/"+docID+"/attachments/", requestOptions) .then(response => response.text()) .then(result => { const obj = JSON.parse(result); console.log("attachmentID: "+obj.id); console.log("uuid: "+obj.uuid); }) .catch(error => console.log('error', error)); this.response = response; console.log("Response: "+this.response); return response;
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!