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

146
Vistas
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
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