Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).on('ready page:load', function () { new Dropzone("#dropzone", {
- autoProcessQueue: false,
- uploadMultiple: true,
- parallelUploads: 100,
- addRemoveLinks: true,
- maxFiles: 10,
- maxFilesize: 10,
- paramName: 'upload[document]',
- init: function() {
- var myDropzone = this;
- // First change the button to actually tell Dropzone to process the queue.
- $("#dropzone").submit(function(e) {
- // Make sure that the form isn't actually being sent.
- e.preventDefault();
- e.stopPropagation();
- myDropzone.processQueue();
- });
- },
- sendingMultiple: function(){
- // Gets triggered when the form is actually being sent.
- // Hide the success button or the complete form.
- },
- successmultiple: function(files, response) {
- $(files.previewElement).find('.dz-remove').attr('id', response.uploadId);
- $(files.previewElement).addClass('dz-success');
- },
- errormultiple: function(files, response) {
- // Gets triggered when there was an error sending the files.
- // Maybe show form again, and notify user of error
- },
- removedfile: function(file) {
- var id = $(file.previewTemplate).find('.dz-remove').attr('id');
- $.ajax({
- type: 'DELETE',
- url: '/uploads/' + id,
- success: function(data) {
- console.log(data.message);
- }
- });
- var previewElement;
- return (previewElement = file.previewElement) != null ? (previewElement.parentNode.removeChild(file.previewElement)) : (void 0);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement