mardi 25 août 2015

HTTPPostedFileBase always return null in controller

I have checked various answer for this, but none of them works for me, my code in .cshtml is as follows:

<input type="file" name="PostedNRLFile" />

and then in controller I have

 public JsonResult SaveRecord(NewAuditLetterViewModel viewModel, FormCollection all, string hvalue, HttpPostedFileBase PostedNRLFile)

Which is always null, Please help me in this.

I have already tried few things like creating a property in viewmodel, this is also null. Also used new { enctype = "multipart/form-data", id = "documentForm" } in my beginform tag. Also checked their is only one tag in source.

Aucun commentaire:

Enregistrer un commentaire