【发布时间】:2016-01-12 12:09:16
【问题描述】:
我有一种发布方法,其中有一个文件上传控件。要在控制器中获取上传的文件,我收到如下错误:
Error CS1061 'HttpRequest' does not contain a definition for 'Files' and no extension method 'Files' accepting a first argument of type 'HttpRequest' could be found (are you missing a using directive or an assembly reference?)
我的代码如下:
[ValidateAntiForgeryToken]
[HttpPost]
public async Task<IActionResult> TeamUserDetail(TeamUsers model)
{
var file = Request.Files[0];
return View();
}
在 Request.Files[0] 它给出了上面显示的错误。项目中使用MVC6。
请指导我。我是否缺少任何要添加的参考?
谢谢
【问题讨论】:
标签: c# file-upload http-post httprequest