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

474
Views
How to download then again upload blob in Javascript using Fetch Api

In the following snippet downloading works as expected but uploading is not working, getting a HTTP 500 response. The issue isn't backend as it works in Postman or equivalent. What could be the issue?

 return fetch('url', {
  method: 'GET',
}).then((response) => {

  //upload

  if (response.status === 200) {
    let blob = response.blob();
    return fetch('url', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/octet-stream',
      },
      body: blob,
    }).then((response) => {
      console.log(response.status);
    });
  }
  
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try using form data,

if (response.status === 200) {
    let blob = response.blob();
    const formData = new FormData();
    formData.set('file', blob);
    return fetch('url', {
      method: 'POST',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      body: blob,
    }).then((response) => {
      console.log(response.status);
    });
  }
about 4 years ago · Juan Pablo Isaza Report
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!