Combine form data with files
Create a form with various other input fields that also acts as a Dropzone.
You want to have a normal form, that you can drop files in, and send the whole form, including the files, with the click of a button? Well, you're in luck. It requires a bit of configuration, but it's not difficult to do.
First off, you need to make sure that Dropzone won't auto process your queue and start uploading each file individually. This is done by setting these properties:
autoProcessQueue: falseDropzone should wait for the user to click a button to uploaduploadMultiple: trueDropzone should upload all files at once (including the form data) not all files individuallyparallelUploads: 100that means that they shouldn't be split up in chunks as wellmaxFiles: 100and this is to make sure that the user doesn't drop more files than allowed in one request.
This is basically everything you need to do. Dropzone automatically submits all input fields inside a form that behaves as a Dropzone.
Show me the code
This is what a very simple HTML looks like:
<form id="upload-form" class="dropzone">
<!-- this is were the previews should be shown. -->
<div class="previews"></div>
<!-- Now setup your input fields -->
<input type="email" name="username" />
<input type="password" name="password" />
<button type="submit">Submit data and files!</button>
</form>And now for the Dropzone configuration:
That's it.
Last updated
Was this helpful?