jeudi 3 septembre 2015

turning autoProcessQueue:true to false makes Dropzone to fail

Im using Dropzone in laravel with a Div input instead a form with the following js.

$('#drzone').dropzone(
     { url: '/photos',
     autoProcessQueue: true,
     uploadMultiple: true,

      init: function() {

         this.on("sendingmultiple", function(file, xhr, formData) {
           formData.append("_token", $('[name=_token]').val());
         });
         this.on("successmultiple", function(files, response) {
         });
         this.on("errormultiple", function(files, response) {
         });

       }

and it works fine. it sends right away the photo uploadings, but when i turn the autoProcessQueue to false because I want to hit the submit button to send all my data it fails and it stops geting a post ok from the server. even if I add the following code

var myDropzone = this;

// First change the button to actually tell Dropzone to process the queue.
this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
  // Make sure that the form isn't actually being sent.
  e.preventDefault();
  e.stopPropagation();
  myDropzone.processQueue();
});

what am I doing wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VyJEtY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire