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

106
Views
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 answers
Answer question

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 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!