success event not getting called when showing existing files on server in dropzone.js

Viewed 140

I am using dropzone to upload files and show existing files if already uploaded on server. On showing existing files, firing success event - which adds the success class in preview element but it is not executing code in success callback function to add a custom div element. the success code is although getting called for new files when uploaded. Issue is only for existing files. Plz help to fix this issue. below is my code:

 init: function() {
        var $this = this;
        var mockFile = { name: value.name};
        mockFile.accepted = true;
        $this.files.push(mockFile);
        $this.emit("addedfile", mockFile);
        $this.emit("thumbnail", mockFile, 'http://localhost/Dropzone/uploads/'+value.name);
        $this.emit("complete", mockFile);
        $this.emit("success", mockFile);
        
this.on("success", function(file) { 
       $(file.previewElement).append("<div class='custom-div'></div>");
});
0 Answers
Related