我知道这个问题被问了很多次,我寻找答案,但我肯定错过了一些东西..
我的观点..
@using TaxiAssistant.Views.CompanyAdmin.Resources
@using (Html.BeginForm("ImportDrivers", "CompanyAdmin", FormMethod.Post, new { enctype = "multipart/form-data" })) {
<input type="file" name="uploadFile" id="file1" />
<br />
<br />
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="@Resources.Import" class="btn btn-default" />
</div>
</div>
}
我的控制器:
[HttpPost]
public ActionResult ImportDrivers(HttpPostedFileBase file)
{
return View();
}
在控制器中参数始终为空。我错过了什么:/