1
Answer

Post model data containg file type using Ajax call in mvc4

Naveen Semwal

Naveen Semwal

10y
723
1
I have a ViewModel containing some string and HttpPostedFileBase properties . When i am posting the model to the controller using below ajax call.
 
 
$.ajax({
url: '@Url.Action("_AddFeedback", "Mcq")',
type: 'post',
data: $('form#frm-feedback').serialize(),
success: function (data)
{
alert("done"); },
error: function (data) {
alert("Error occured while saving Option's data."); } });


I am getting value for string but null for HttpPostedFileBase type properties. How can we post HttpPostedFileBase file using ajax ??
 
Answers (1)