Skip to content Skip to sidebar Skip to footer

Use Dropzone.options Without Form

I want to use dropzone on with id. But my Dropzone.options.myid={} is not working. How to validate file type, size in var myDropzone = new Dropzone('div#myid', { url: '/file/post'

Solution 1:

I don't see where are you using dropzone class to define your dropzone area, does it generate you the default dropzone?

<div id="myDropZone" class="fallback dropzone" enctype="multipart/form-data">
      <input type="file" id="files" class="display" multiple />
</div>

First you need to detach the default dropzone, add this out of you document ready load.

Dropzone.autoDiscover = false;

Then you jquery or js

 var $myDropZone;
 $myDropZone= new Dropzone('div#myDropZone', {*all your settings* 
  addRemoveLinks: true, //to remove
  dictRemoveFile: '<i class="fa fa-times-circle" style="font-weight: 900; 
  cursor:pointer;"></i>' //I used an icon and styled as button so to give a user 
  experience to remove it});

Hope it helps, regards.


Post a Comment for "Use Dropzone.options Without Form"