Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

392
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda