user3653474
user3653474

Reputation: 3854

Remove icon not appearing in dropzone

I am working with Dropzone in a Laravel project. I have successfully implemented it but the remove icon is not appearing after I upload an image.

<div class="">
  <div class="dropzone" id="dropzoneFileUpload"></div>
</div>
Dropzone.options.myAwesomeDropzone = {
  paramName: "file",
  addRemoveLinks: true,
  maxFilesize: 5, // MB
  init: function() {},
  accept: function(file, done) {},
  removedfile: function(file) {},
};

Upvotes: 1

Views: 2034

Answers (2)

Amit Sharma
Amit Sharma

Reputation: 1795

after the addRemoveLinks add the following lines to the options

removedfile: function (file) {
 var _ref;
 return (_ref = file.previewElement) != null ? ref.parentNode.removeChild(file.previewElement) : void 0;        
},

Upvotes: 1

Tim Rasim
Tim Rasim

Reputation: 684

I can't be sure but maybe Dropzone is already initialised when you set the addRemoveLinks option. Can you try to do it while initialising like this (in your domReady):

Dropzone.autoDiscover = false;
var myDropzone = new Dropzone('#dropzoneFileUpload', {
    paramName: "file",
    addRemoveLinks: true,
    maxFilesize: 5, // MB
    init: function() {},
    accept: function(file, done) {},
    removedfile: function(file) {}
}

Upvotes: 1

Related Questions