Naveen Semwal

Naveen Semwal

  • NA
  • 1
  • 927

Post model data containg file type using Ajax call in mvc4

Jul 31 2014 3:40 AM
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)