0

My model

 public class Test
    {
        public string Name { get; set; }
        public string Category { get; set; }
        public HttpPostedFileBase ImageFile { get; set; }
    }

I need send file with other fields. When I use Dropzone, ImageFile always is null. In View

@using (Html.BeginForm("Index", "Default", FormMethod.Post, new { enctype = "multipart/form-data",@class= "dropzone",id= "myDropzone" }))
    {
        @Html.LabelFor(p=>p.Name)
        @Html.TextBoxFor(p=>p.Name)
        @Html.LabelFor(p=>p.Category)
        @Html.TextBoxFor(p=>p.Category)
        @Html.LabelFor(p=>p.ImageFile)
        <div class="fallback">
            <input type="file" name="@Html.NameFor(p=>p.ImageFile)">
        </div>

        <input type="submit" id="submit-all" />
    }

and dropzoe

Dropzone.options.myDropzone = {

            // Prevents Dropzone from uploading dropped files immediately
            autoProcessQueue: false,
            init: function () {
                var submitButton = document.querySelector("#submit-all");
                var myDropzone = this; //closure

                submitButton.addEventListener("click", function () {

                    //tell Dropzone to process all queued files
                    myDropzone.processQueue();
                });

            }

        };

It possible submit all data in one request to a one action?

Starter
  • 329
  • 1
  • 3
  • 9
  • Have you included `Dropzone.autoDiscover = false;` (refer [this Q/A](https://stackoverflow.com/questions/29488559/dropzone-not-bound-to-model)) –  Feb 10 '18 at 12:06
  • yes, but ImageFile is null, and form automatic submit after select files via dropzone – Starter Feb 11 '18 at 06:59

0 Answers0