How to get Dropzone.js to upload files only when a submit button is clicked?
You can supply your own url to upload the file. Currently I am just setting it as 'someurl'
Dropzone.autoDiscover = false;jQuery(document).ready(function() { var myDropzone = new Dropzone("#myId", { url: 'someurl', autoProcessQueue:false }); $('#add').on('click',function(e){ e.preventDefault(); myDropzone.processQueue(); }); });
<script>$(document).ready(function () { Dropzone.options.dropzoneForm = { autoProcessQueue: false };});function processEvent() { // call this to trigger the upload $('#dropzoneForm').get(0).dropzone.processQueue();}</script><form action="/your-post-url-here" method="post" enctype="multipart/form-data" class="dropzone" id="dropzoneForm"></form>