0

Hi I have class of EmployeeDocumentsTable

public class EmployeeDocumentsTable
{
   public HttpPostedFileBase EmployeeDocumentFileName { get; set; }

   // Other properties
}

in my view

@Html.TextBoxFor(model => model.EmployeeDocumentFileName, new { type = "file" })

The problem is when I post the form using submit button the property EmployeeDocumentFileName is null.

nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • Your form should have multi part attribute see: http://stackoverflow.com/questions/25125127/asp-net-mvc-4-c-sharp-httppostedfilebase-how-do-i-store-file – Ehsan Sajjad Nov 15 '14 at 11:13

1 Answers1

0

1) Does your form include enctype="multipart/form-data" attribute ?

2) See this answer MVC 3 file upload and model binding

Community
  • 1
  • 1
Andzej Maciusovic
  • 4,306
  • 1
  • 29
  • 40