I have this sample:
link
I managed to create this form but unfortunately it does not work because I get error.
Dropzone already attached.
CODE HTML:
<div class="dropzone dz-clickable" id="myDrop">
<div class="dz-default dz-message" data-dz-message="">
<span>Drop files here to upload</span>
</div>
</div>
CODE JS:
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("div#myDrop", { url: "/file/post"});
// If you use jQuery, you can use the jQuery plugin Dropzone ships with:
$("div#myDrop").dropzone({ url: "/file/post" });
I set up Dropzone.autoDiscover = false;
but unfortunately still not working.
Can you please tell me what is causing this problem?
You can call removeAllFiles function to clear dropzone object before upload.So when ever you try to upload something using dropzone it will be always clear.
If you are creating Dropzones Programmatically then you have to set your options like below: Dropzone. autoDiscover = false; profilePicture = new Dropzone('#profile-picture', { url: "/uploadPicture.
js is one of the most popular drag and drop JavaScript libraries. It is free, fully open source, and makes it easy for you to handle dropped files on your website. It's meant to look good by default, and is highly customizable. Documentation Download.
Defining below code globally will help:
Dropzone.autoDiscover = false;
You should use either
var myDropzone = new Dropzone("div#myDrop", { url: "/file/post"});
or
$("div#myDrop").dropzone({ url: "/file/post" });
not both. Basically what you are doing is calling the same thing twice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With