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

108
Vistas
First arg must be a Blob object or a File object. Image compressor

I am making an image compressor. In the image you see a simple design with a dragon drop to fill in ur files. But i want to download the image i keep getting one error (displayed below).

[This is what i got so far.][1] [1]: https://i.stack.imgur.com/2RJ3v.png

This is my download funtion but when i press the button to download i keep getting 1 error

  function download(file, res) {
    console.log(file);
    var fdata = new FormData()
    fdata.append('upload_preset', 'image_name')
    fdata.append('file', file)
    // converts the picture and instant download the new image.
    imageConversion.compressAccurately(file, 50).then(res=>{
      console.log(res)
      imageConversion.downloadFile(res)
    })
  }

Error:

conversion.js:1 Uncaught (in promise) Error: compressAccurately(): First arg must be a Blob object or a File object.

I tried a lot of things but i can't really figure it out. Someone got any idea how to solve this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I figured it out. I had to add an Array and make the file excisable for all functions.

function handleFiles(files) {
  window.files = files;
  files = [...files];
  files.forEach(previewFile);
}

function download() {
  Array.from(files).forEach((element) => {
    // converts the picture and instant download the new image.
    imageConversion.compressAccurately(element, 50).then((res) => {
      console.log(res);
      imageConversion.downloadFile(res, 'test');
    });
  });
}
about 4 years ago · Juan Pablo Isaza Denunciar
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