这是我的看法。我正在尝试进行文件上传控制。
@section termimalContent {
@using (Html.BeginForm("Add", "Terminals_Policies", "multipart/form-data"))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>
<h2>
Create new policy</h2>
</legend>
<p>
<strong>Assigning devices to Node:</strong> @Model.GroupName</p>
<div class="editor-label">
@Html.LabelFor(model => model.PolicyName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PolicyName)
@Html.ValidationMessageFor(model => model.PolicyName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.PolicyType)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.SelectedItems, new SelectList(Model.PolicyType, "Value", "Text"))
@Html.ValidationMessageFor(model => model.SelectedItems)
</div>
<div class="editor-label">
<label for="file1">
Filename:</label>
</div>
<div class="editor-field">
<input type="file" name="files" id="file1" />
</div>
<div class="editor-label">
<label for="file2">
Filename:</label>
</div>
<div class="editor-field">
<input type="file" name="files" id="file2" />
</div>
@Html.HiddenFor(model => model.GroupId)
@Html.HiddenFor(model => model.GroupName)
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
}
但 html 被呈现为:
<form action="/Terminals_Policies/Add/1?Length=19" id="form0" method="post">
任何人都知道我做错了什么