javascript - Drop images from browser using dropzone.js -
i making web chat application has feature drag-drop file , upload server (i have make whatsapp web has feature). i'm using dropzone.js achieve , has been working great far except 1 thing. event 'sending' never called when dropping image browser. here's example
new dropzone('.drag-overlay', { url: "www.example.com", paramname: "attachment", init: function() { this.on("drop", function(e){ console.log("drop event"); }); this.on("sending", function(file){ console.log("sending event"); }); } });
the drop event called fine sending never called. can give me direction how can send file browser using library?
thanks
sending event call . upload document . change call dropzone method .
var mydropzone = new dropzone
live demo here . see console in web
see below example
// dropzone class: var mydropzone = new dropzone(".drag-overlay", { url: "www.example.com", paramname: "attachment", init: function() { this.on("drop", function(e){ alert('drop event'); console.log("drop event"); }); this.on("sending", function(file){ alert('sending event'); console.log("sending event"); }); /*this code remove tooltip error*/ this.on('error', function(file, errormessage) { var mypreview = document.getelementsbyclassname('dz-error'); mypreview = mypreview[mypreview.length - 1]; mypreview.classlist.toggle('dz-error'); mypreview.classlist.toggle('dz-success'); }); } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.css" rel="stylesheet"/> <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/basic.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.js"></script> <div class="clsbox-1" runat="server" > <div class="dropzone drag-overlay" id="drag-overlay"> </div> </div>
Comments
Post a Comment