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

147
Views
Call removeFile in for-loop

In a dropzone.js, I have a script to create multiple folders, and this works with 2 actions, after a button (so autoprocessqueue is false).

The first action is to create the right database-entry, and create the folder. This returns an object with the Foldername, and the UUID from the database. If this fails, the Foldername gets the value false instead of the UUID.

Then I process my dropzone.getQueuedFiles to remove files where the folder has not been created.

However in this for-loop not every file is deleted, but only some of it.

document.getElementById('CreateBundelButton').addEventListener("click", function(e) {
    axios.post(uploadConfig.multibundelUploadUrl + collectie.uuid + '/', { collectie : collectie , isBundelCreateAndCheck : true , folders : BundelFolders })
                    .then( response => { 
         console.log("Received UUIDs")
         for(let fList = 0 ; fList < dropzone.getQueuedFiles().length ; fList++) {
             let rootFolder = (dropzone.getQueuedFiles()[fList].fullPath).split('/')[0]
             if(response.data.uuidList[rootFolder] !== false) { 
                  //set folder-view as created 
             } else {  
                  dropzone.removeFile(dropzone.getQueuedFiles()[fList]) 
             }
         }
         //setAutoProcessDropzone(true)
         //dropzone.processQueue()
    }
}

So when I click the button, not every file from the folder where response.data.uuidList[rootFolder] = false get removed.

Update: everytime only half of the files are removed from the queue. So a folder with 100 files, 50 are removed, a folder with 10, 5 are removed.

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!