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

396
Views
How do I convert img url into blob object file in javascript?

I'm trying to convert the img link into blob. I want to send the blob as the object file, currently I got the blob as [object HTMLImageElement]. How do I fix this and send it as blob [object File] ?

This is what I'm trying to achieve enter image description here

var myImage;
fetch('https://cdn.vox-cdn.com/thumbor/4hL2bA5OUf0lSqR2WlY9ogSYtTE=/152x62:1340x953/920x613/filters:focal(615x92:829x306):format(webp)/cdn.vox-cdn.com/uploads/chorus_image/image/66220207/the_child_star_wars_gallery_5e3204be4f668.0.jpg')
  .then(res => res.blob()) // Gets the response and returns it as a blob
  .then(blob => {

    let objectURL = URL.createObjectURL(blob);
    myImage = new Image();
    myImage.src = objectURL;

    console.log(myImage);
  });

$("#approve").click(function() {
  var logoFilename = myImage;
  let formData = new FormData();
  formData.append('logo', logoFilename);
  for (var pair of formData.entries()) {
    console.log(pair[0] + ', ' + pair[1]);
  }

});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<button type="button" id="approve" name="approve" class="btn btn-success">Approve</button>

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!