How to catch events of dropzonejs plugin

I use plugin dropzonejs.com. Now I write in html document this code

<form action="<?php print $this->link('task', 'upload'); ?>" id="pinupload" class="dropzone" style="width:450px;">
                        </form>

and it's working perfect. But I need catch events of dropzone: when file is uploaded, when start uploading for confirm.

I wrote this code:

Dropzone.options.myDropzone = {
    init: function() {
      this.on("addedfile", function(file) {

       // Capture the Dropzone instance as closure.
        var _this = this;

        // Listen to the click event
        removeButton.addEventListener("click", function(e) {
          // Make sure the button click doesn't submit the form:
          e.preventDefault();
          e.stopPropagation();

          // Remove the file preview.
          _this.removeFile(file);
          // If you want to the delete the file on the server as well,
          // you can do the AJAX request here.
        });
      });
    }
  };

but with this code I can not catch event. WHy ?

Upvotes: 1

Views: 591

Answers (1)

Sorry it's code working, simply I inattentive. Id of form should has "myDropzone".

Upvotes: 1

Related Questions