I use Dropzone to upload files client side. I have set up Dropzone programmatically using JQuery and I would like to be able to detach it so the user can no longer upload anymore files. My ideal solution is to simply make it unclickable then apply a default message to indicate to the user they have exceeded the number of uploads.
Here is a simple example: http://www.dressorganic.co.uk/dropzone-test/turn-off-dropzone-after-load.htm
Here I try to make it unclickable after the success event but nothing happens.
Here is a link to what I actually want it to look like after a successful upload: http://www.dressorganic.co.uk/dropzone-test/dropzone-disabled.htm
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Turn off Dropzone after load</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/dropzone-test/dropzone/4.0.1/dist/min/dropzone.min.js"></script>
<link rel="stylesheet" href="/dropzone-test/dropzone/4.0.1/dist/min/dropzone.min.css">
<script type="text/javascript">
//<![CDATA[
$(function() {
$("#upload1").dropzone({
createImageThumbnails : false,
url: "/dropzone-test/handleupload.asp",
acceptedFiles : ".jpg,.jpeg,.png,.gif",
dictDefaultMessage : "Click here or drag and drop files to upload",
addRemoveLinks : false,
success : function(file) {
this.removeAllFiles();
$("#upload1").dropzone({
clickable : false,
url: "/dropzone-test/handleupload.asp",
dictDefaultMessage : "You have exceeded the number of uploads, please remove existing to add more"
});
},
});
}); // JQuery
//]]>
</script>
</head>
<body>
<div id="singleproductload">
<div id="upload1" class="dropzone">
</div>
</div>
</body>
</html>