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?