dropzone on complete code example

Example 1: dropzone on success all files

Dropzone.options.filedrop = {
  init: function () {
    this.on("complete", function (file) {
      if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
        doSomething();
      }
    });
  }
};

Example 2: dropzone add download button addedfile

//Prepare the drop zone area
var myNewdDropzone = new Dropzone("#idOfForm",  {
    url: "my-ajax.php",
    method: "POST",
    addRemoveLinks: false,
    clickable: true,
    previewTemplate: document.querySelector('#preview-template').innerHTML,
    init : function() {
        this.on("addedfile", function(file) { new_file_added(file); });
        this.on("thumbnail", function(file,fileurl) { new_thumbnail_added(file); });
        this.on("removedfile", function(file) { new_file_removed(file); });
        this.on("totaluploadprogress", function(progress) { display_progress(progress); });
        this.on("queuecomplete", function() { all_files_uploaded(); });
        //this.on("processing", function(file) { new_file_processed(file); });
    }
});