Skip to main content
1 of 2
clement
  • 4.2k
  • 10
  • 66
  • 136

dropzone multiple area's in same form

I'm making complex form And I want to use multiple (different) dropzone.js in order to upload files.

Here is how I made:

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
... form elements...
<div id="files" name="files" class="dropzone"></div>
}

And the JS:

Dropzone.options.files = {
    autoProcessQueue: false,
    uploadMultiple: true,
    parallelUploads: 100,
    maxFiles: 100,

    paramName: "file", // The name that will be used to transfer the file
    maxFilesize: 8, // MB
    url: "/pathToAction"
};

I want to send files and data of the form at the same time, all mapped to an object to the controller but dropzone needs to have the "url" in order to accept file upload... How to fix this? Maybe I can get the url of the form element and put it into the url parameter? Is there a best way to doing that?

Thanks in advance

clement
  • 4.2k
  • 10
  • 66
  • 136