javascriptdropzone.js

dropzone "You can not upload any more files" after error with maxFiles:1


When an error happens, and maxFiles is set to 1, dropzone does not try to upload another file.

It somehow thinks it already have updated the file.

$(this.element).dropzone({
      maxFiles: 1,
      createImageThumbnails: false,
      dictDefaultMessage: '',
      clickable: true,
      paramName: this.paramNameValue,
      url: this.urlValue,
      method: this.methodValue,
      init: function() {
        this.on("error", (fileObject, response) => {
          let msg
          try {
            msg = JSON.parse(response).join(', ')
          } catch (e) {
            msg = response;
          }
          console.log('error', msg)

        });
      }
    })

Solution

  • As @DBS mentions I found the solution to be to manually remove the file.

    This is how it looks:

    $(this.element).dropzone({
          // ....
          init: this.on("error", (fileObject, response) => {
              this.removeAllFiles();
              // ...
            });
          }
        })