0

I work with dropzone:

<form action="#" class="dropzone"  ></form>

In the code js, the dropzone upload images only if a button with id=startUpload is clicked.

         Dropzone.autoDiscover = false;
        $(function() {
            var myDropzone = new Dropzone(".dropzone", {
                url: "upload_hotel_image.php",
                paramName: "file",
                maxFilesize: 20,
                maxFiles: 20,
                acceptedFiles: "image/*,
                autoProcessQueue: false,

            });      
          $(document).ready(function(){  
   $('#startUpload').click(function(){   
            myDropzone.processQueue();
       });
        });
              });

Now, how can i add more data to send with dropzone when images are uploaded, for exapmle,i need send description with every image uploaded.

user3623368
  • 63
  • 1
  • 8
  • https://www.dropzonejs.com/#event-sending further down on that page "Dropzone will submit any hidden fields you have in your dropzone form. So this is an easy way to submit additional data. You can also use the params option." - not clear if this will also submit and normal fields or only hidden ones. Either way, stick an input inside the dropzone form and see what happens. – freedomn-m Mar 07 '19 at 08:57
  • Hey man you still need help with this? – CodeBoyCode Mar 07 '19 at 17:09
  • yes,i still need helpfor this – user3623368 Mar 08 '19 at 13:37
  • Possible duplicate with this [post](https://stackoverflow.com/questions/26472952/adding-more-data-to-dropzone-js-post) – Camille Jul 25 '19 at 10:06

1 Answers1

0

//do this in your init function this.on("sending", function(file, xhr, formData) {

    $("form").find("input").each(function(){
      formData.append($(this).attr("name"), $(this).val());
  });