$(function() {
// Get the template HTML and remove it from the doumenthe template HTML and
// remove it from the doument
var previewNode = document.querySelector("#template");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
Dropzone.options.formDZ = {
autoProcessQueue : false,
uploadMultiple : true,
parallelUploads : 100,
maxFiles : 100,
maxFilesize : 1000,
clickable : '#addDZ',
previewTemplate : previewTemplate,
previewsContainer : '#previewDZ',
createImageThumbnails : false,
paramName : 'file',
init : function() {
$('#submitDZ').attr('disabled', 'disabled');
var _this = this;
$('#formDZ').submit(function(e) {
e.preventDefault();
e.stopPropagation();
_this.processQueue();
});
// $('#submitDZ').on('click', function(e) {
// e.preventDefault();
// e.stopPropagation();
// _this.processQueue();
// });
$('#clearDZ').on('click', function() {
_this.removeAllFiles();
});
this.on('addedfile', function() {
// Show submit button here and/or inform user to click it.
// $('#submitDZ').attr('disabled','disabled');
$('#submitDZ').removeAttr('disabled');
});
this.on('complete', function(data) {
var res = data.xhr.responseText;
window.location.href = res;
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
// $('#submitDZ').removeAttr('disabled');
// $.post("demo_test.asp", function(data, status){
// alert("Data: " + data + "\nStatus: " + status);
// });
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
});
}
};
});