上传文件示例

This commit is contained in:
hbybyyang 2023-10-11 18:52:18 +08:00
parent 68966ed7d7
commit 76999b805d

View File

@ -4,7 +4,7 @@
}
@using (Html.BeginForm())
@using (Html.BeginForm("ImageUpload", "HomeController", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@ -23,7 +23,7 @@
<div class="form-group">
@Html.LabelFor(model => model.imageFile, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.imageFile, new { htmlAttributes = new { @class = "form-control" } })
<input type="file" name="imageFile" id="imageFile" />
@Html.ValidationMessageFor(model => model.imageFile, "", new { @class = "text-danger" })
</div>
</div>