dropzone file upload code example
Example 1: dropzone upload on one file
init: function() {
this.on('addedfile', function(file) {
if (this.files.length > 1) {
this.removeFile(this.files[0]);
}
});
}
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>