我有一个模型类:
public class Register
{
public Employee Employee { get; set; }
public Business Business { get; set; }
}
我有一个HTML表单,其中包含输入类型文本,其中包含来自模型的员工和业务数据以及用于加载图像的输入类型文件:
@using (Html.BeginForm(null, null, FormMethod.Post, new { @id = "frmRegister", @enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<div class="div-file">
<input id="inputFile" title="Upload a business image" type="file" name="UploadedFile" accept="image/*" />
</div>
<div class="div-input">
@Html.Label("Name:", htmlAttributes: new { @for = "txtName" })
@Html.EditorFor(model => model.Employee.Name, new { htmlAttributes = new { @class = "form-control", @id = "txtName" } })
</div>
<div class="div-input">
@Html.Label("Age:", htmlAttributes: new { @for = "txtAge" })
@Html.EditorFor(model => model.Employee.Age, new { htmlAttributes = new { @class = "form-control", @id = "txtAge" } })
</div>
<div class="div-input">
@Html.Label("Company:", htmlAttributes: new { @for = "txtCompany" })
@Html.EditorFor(model => model.Business.Name, new { htmlAttributes = new { @class = "form-control", @id = "txtName" } })
</div>
<div class="div-input">
@Html.Label("Phone:", htmlAttributes: new { @for = "txtPhone" })
@Html.EditorFor(model => model.Business.Phone, new { htmlAttributes = new { @class = "form-control", @id = "txtPhone" } })
</div>
<div class="text-center">
<input type="button" id="btnRegister" value="Register" class="btn btn-default" />
</div>
}
问题是:如何传递图像文件?
料青山看我应如是
神不在的星期二
qq_遁去的一_1
随时随地看视频慕课网APP
相关分类