如何处理DropZone.js文件上传完成

时间:2014-06-10 13:06:28

标签: javascript image dropzone.js

上传文件后,我希望能够将其从DropZone HTML元素移到LI项目中。

HTML Structur

<div class="dropzone"> FROM HERE.jpg </div>

<ul>
    <li>TO HERE.jpg</li>
</ul>

JS

$(function() {



  // event listeners
  var myDropzone = new Dropzone("div#mydrop", { url: "/images/upload/"});


  //NOT WORKING
  myDropzone.on("addedfile", function(file) {
    file.previewElement.addEventListener("click", function() { 

  });  



  //feedback
  Dropzone.options.myDropzone = {


    init: function() 
    {
          this.on("success", function(file, responseText) {
           //do stuff
          });          
          this.on("complete", function(file) {
           //do stuff
          });  
          this.on("addedfile", function(file) {
           //do stuff
          });
          this.on("uploadprogress", function(file) {
           //do stuff
          });          

    }

  };


});

1 个答案:

答案 0 :(得分:0)

将此添加到您的完整功能:

myDropzone.removeFile(file);