dropzone.js form submit not sending file

Philip Lewis

I'm having some trouble with using Dropzone.js within a standard html form. With the code I have, everything is working as it should, I can click the area to add an image, I can only add one image at a time, and the image is only uploaded when the submit button is pressed. However, nothing is actually sent when submit is pressed. I know I need to manually process the queue, but this doesn't seem to be working at all. The rest of the form data is sent however, it's only the image which isn't.

I'm using the following simplified code. (Assume that this works other than no file being sent.)

HTML

<form action='upload.php' method="post" class="dropzone" id="mydz">
<input type='submit' name='submitimage' value='Save' style='float:left;'/>

JAVASCRIPT

Dropzone.options.mydz = {
   autoProcessQueue: false,
   maxFiles: 1,

   init: function() {
      var submitButton = document.querySelector("#submitimage");
      mydz = this; // closure

      submitButton.addEventListener("click", function() {
         mydz.processQueue(); // Tell Dropzone to process all queued files.
      });                                    

      this.on('addedfile', function(file){ if(this.files.length > 1) { this.removeFile(this.files[0]); } });
   }
}

I've been trying to solve this all day now, and no amount of searching online has revealed anything useful to me. Can any of you help?? :)

Philip Lewis

Bingo!!! With some help from the author of the github post i linked to earlier, this issue has now been resolved!

The code I posted earlier works as it is, however inside the dropzone.js file, I added these two lines this.hiddenFileInput.setAttribute("name", _this.options.paramName); $("form.dropzone").append(_this.hiddenFileInput);

after document.body.appendChild(_this.hiddenFileInput); and all is working as it should!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Build a list of filenames in Dropzone.js to pass in form submit

From Dev

Dropzone: Submit both form data and dropzone at once

From Dev

Sending an email on form submit

From Dev

Sending an email on form submit

From Dev

Extjs Form submit not sending binary data of file during upload

From Dev

JQuery form submit not sending post

From Dev

autocomplete not sending data with form submit

From Dev

How to submit the hidden input fields also along with file in dropzone.js

From Dev

How to submit the hidden input fields also along with file in dropzone.js

From Dev

Dropzone.js submit for multi ids

From Dev

Javascript Submit is not Sending SUBMIT POST to php file

From Dev

Why is not my HTML form sending the data to my JS file?

From Dev

react js / superagent / file dropzone

From Dev

Angular js form submit

From Dev

Sending form data to a popup on button submit

From Dev

How to submit a Contact Form without sending email?

From Dev

Issue when sending form with submit button disabled

From Dev

Jquery: submit function not working at sending form

From Dev

Simple Form on Submit is not sending the input to MySQL

From Dev

Ajax sending multiple request on form submit

From Dev

Dropzone, how do I submit form with data and multiple images?

From Dev

Dropzone, how do I submit form with data and multiple images?

From Dev

How to disable clickable the form with Dropzone.js?

From Dev

dropzone: submit button doesn't work when no file selected

From Dev

sending .js file with HttpExchange

From Dev

form not sending image file to email

From Dev

how to redirect page on submit with Dropzone.js and Rails 4?

From Dev

Update cached file on form submit

From Dev

submit form as soon as file was selected

Related Related

  1. 1

    Build a list of filenames in Dropzone.js to pass in form submit

  2. 2

    Dropzone: Submit both form data and dropzone at once

  3. 3

    Sending an email on form submit

  4. 4

    Sending an email on form submit

  5. 5

    Extjs Form submit not sending binary data of file during upload

  6. 6

    JQuery form submit not sending post

  7. 7

    autocomplete not sending data with form submit

  8. 8

    How to submit the hidden input fields also along with file in dropzone.js

  9. 9

    How to submit the hidden input fields also along with file in dropzone.js

  10. 10

    Dropzone.js submit for multi ids

  11. 11

    Javascript Submit is not Sending SUBMIT POST to php file

  12. 12

    Why is not my HTML form sending the data to my JS file?

  13. 13

    react js / superagent / file dropzone

  14. 14

    Angular js form submit

  15. 15

    Sending form data to a popup on button submit

  16. 16

    How to submit a Contact Form without sending email?

  17. 17

    Issue when sending form with submit button disabled

  18. 18

    Jquery: submit function not working at sending form

  19. 19

    Simple Form on Submit is not sending the input to MySQL

  20. 20

    Ajax sending multiple request on form submit

  21. 21

    Dropzone, how do I submit form with data and multiple images?

  22. 22

    Dropzone, how do I submit form with data and multiple images?

  23. 23

    How to disable clickable the form with Dropzone.js?

  24. 24

    dropzone: submit button doesn't work when no file selected

  25. 25

    sending .js file with HttpExchange

  26. 26

    form not sending image file to email

  27. 27

    how to redirect page on submit with Dropzone.js and Rails 4?

  28. 28

    Update cached file on form submit

  29. 29

    submit form as soon as file was selected

HotTag

Archive