如何上传多个文件MVC 3

AFe*_*ter 3 c# asp.net-mvc-3

我需要从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>&nbsp;</td>
                   <td><input type="submit" value="@Resources.Global.enviar" /></td>
              </tr>
         </table>
    }
Run Code Online (Sandbox Code Playgroud)

控制器:

[HttpPost] public ActionResult Index(IEnumerable<HttpPostedFileBase> fileUpload,  FormCollection collection)  
{
      return View();  
}
Run Code Online (Sandbox Code Playgroud)

但是fileUpload == Null;

Gra*_*ler 5

将输入名称更改为fileUpload.您的文件输入名称是文件.然后,您正在寻找fileUpload来填充您的IEnumerable文件.