Determine when all files have uploaded successfully in dropzone.js
<p>I'm using dropzone.js to upload to my website. The uploader is in a modal, which I want to automatically close when all files have been uploaded successfully.</p>

<p>To do this I am using the following code:</p>

<pre><code>buttonUpload.on("complete", function (file) {

    var remaining = buttonUpload.getRejectedFiles().length + buttonUpload.getQueuedFiles().length + buttonUpload.getUploadingFiles().length

    if (remaining == 0) {
        $("#modal-upload-file").modal('hide');
    }
});
</code></pre>

<p>I would expect this code to add together the number of files that have failed, have not yet uploaded and are uploading. If this is zero, then the  modal closes.</p>

<p>I was able to determine that <code>buttonUpload.getRejectedFiles()</code> does not include files that received an error when uploading. From reading the documentation, I can see no way of checking if every file has uploaded successfully like I want to. How can I do this?</p>