I\'m growing thin learving mvc3. I have the following code in my controller
[HttpPost]
public ActionResult Accreditation(Accreditation accreditation)
var fileUpload = Request.Files[0];
is the line where you have your exception, isn't it? You should expect the file to be stored in the property of class Accreditation
, not in Request.Files
.
So you need properties PressCard
and Passport
in Accreditation
, both of type HttpPostedFileBase
, and then use these properties in your code.