Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created February 11, 2015 21:20
Show Gist options
  • Save johnmmoss/30b396d2377fb188c08d to your computer and use it in GitHub Desktop.
Save johnmmoss/30b396d2377fb188c08d to your computer and use it in GitHub Desktop.
ASP.NET Razor View for File Upload
// The view needs to have the enctype set to multipart form data, also, TextBoxFor takes type of file
@using (Html.BeginForm("Statement", "Customer", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
// Sample Razor
<div class="form-group">
@Html.LabelFor(m => m.CustomerStatementFile, new { @class = "control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(m => m.CustomerStatementFile, new { @class = "form-control", type = "file" })
</div>
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment