Complex object with httppostedfilebase wont bind uppon submit

Viewed 128

Hi im having a problem with my complex object, here is my model

public class screen{
      public dictionaryscreen currentvalue {get; set;}
      public dictionaryscreen newvalue {get;set;}
}

public class dictionaryscreen{
      public string name {get; set;}
      public HttpPostedFileBase imagefile {get;set;}
}

And here is my method:

public ActionResult Submit(screen model){
     [Some logic....]
}

And lastly my view

@model project.Models.screen

@using(Html.BeginForms())
{
     @Html.TextBoxFor(m => m.newvalue.name)
     @Html.TextBoxFor(m => m.newvalue.imagefile , new { type = "file"})
}

Upon submission the model has the value of name but the file got null. What can i do to get the file with this kind of model.

Thank you.

1 Answers
Related