dropzone get uploaded files code example
Example 1: dropzone add download button addedfile
var myNewdDropzone = new Dropzone("#idOfForm", {
url: "my-ajax.php",
method: "POST",
addRemoveLinks: false,
clickable: true,
previewTemplate: document.querySelector('#preview-template').innerHTML,
init : function() {
this.on("addedfile", function(file) { new_file_added(file); });
this.on("thumbnail", function(file,fileurl) { new_thumbnail_added(file); });
this.on("removedfile", function(file) { new_file_removed(file); });
this.on("totaluploadprogress", function(progress) { display_progress(progress); });
this.on("queuecomplete", function() { all_files_uploaded(); });
}
});
Example 2: dropzone accepted files
<script type="text/javascript">
Dropzone.options.dropzone = {
accept: function(file, done) {
console.log(file);
if (file.type != "image/jpeg") {
done("Error! Files of this type are not accepted");
}
else { done(); }
}
}
</script>