hi
how to upload files with mode in ajax
I want to upload a file with model using ajax
@Html.TextBoxFor(t => t.FileUpload, new { type = "file", style = "margin-left: 3%;data-val-required=please select a file" })
var model = new Object();
model.Durumu = $('#Durumu').val();
model.Respond = $('#Respond').val();
model.Hdn1 = $('#Hdn1').val();
model.Type = $('#Type').val();
model.Crtype = $('#Crtype').val();
model.TransGuid = $('#TransGuid').val();
model.Onaylayan = $('#Onaylayan').val();
model.Taxnr = $('#Taxnr').val();
model.Companyname = firma;
model.FileUpload = ($("#FileUpload"))[0].files[0];
$.ajax({
url: "/Responder/CustomerRespond",
type: "Post",
data: JSON.stringify(model),
contentType: "application/json; charset=UTF-8",
dataType: "json",
success: function (response) {
},
error: function (response) {
alert(response);
}
});
}
[HttpPost]
public ActionResult CustomerRespond(MutRespond model ,HttpPostedFileBase FileUpload)
{
}