我需要从MVC3上传多个文件。但是我在服务器上没有获取到变量。这是我的代码。
@using (Html.BeginForm("Index","Register", FormMethod.Post, new { enctype = "multipart/form-data" })) {
@Html.ValidationSummary(true)
<table>
<tr>
<td class="label">@Resources.Global.exemploFotos</td>
<td><input type="file" name="file" class="multi" accept="gif|jpg" maxlength="3" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="@Resources.Global.enviar" /></td>
</tr>
</table>
}
控制器:
[HttpPost] public ActionResult Index(IEnumerable<HttpPostedFileBase> fileUpload, FormCollection collection)
{
return View();
}
但是fileUpload == Null;