Skip to content

Instantly share code, notes, and snippets.

@fsuuaas
Created July 19, 2017 15:30
Show Gist options
  • Save fsuuaas/f119857f3de9d7ab139d32058a0a169c to your computer and use it in GitHub Desktop.
Save fsuuaas/f119857f3de9d7ab139d32058a0a169c to your computer and use it in GitHub Desktop.
Dropzone.options.uploadImages = {
autoProcessQueue: false,
maxFilesize: 2048,
uploadMultiple: false,
parallelUploads: 100,
acceptedFiles: 'image/*',
addRemoveLinks: true,
dictRemoveFile: 'Remove',
init: function() {
var submitButton = document.querySelector("#submit-images")
addImages = this; // closure
submitButton.addEventListener("click", function(e) {
e.preventDefault();
e.stopPropagation();
addImages.processQueue(); // Tell Dropzone to process all queued files.
});
this.on("addedfile", function(file) {
// Show submit button here and/or inform user to click it.
});
this.on("success", function() {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
window.location.href = 'http://localhost:8000/user/orders/manage/';
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment