How to add “multipart/form-data” property to a Html.BeginForm in ASP.NET MVC Razor View ?

You can add multipart/form-data property to an html form in ASP.NET MVC Razor view easily by setting values of the 3rd parameter of the @Html.BeginForm.

Below is a sample sourecode demonstrating the usage of How to add “multipart/form-data” property to a Html.BeginForm in ASP.NET MVC Razor View ?

@Html.BeginForm(
    "ActionName", "ControllerName", FormMethod.Post, new { enctype="multipart/form-data"})
{
// Code for the View
}

Simple wasn’t it ?

Leave a Comment