我收到一个错误HttpPostedFileBase:
找不到类型或命名空间名称“HttpPostedFileBase”(您是否缺少 using 指令或程序集引用?)
我已经尝试使用,using System.Web但根本不起作用。
编辑 #1
public IActionResult Upload(HttpPostedFileBase file)
{
if (file.contentlength > 0)
{
var filename = Path.GetFileName(file.filename);
var path = Path.Combine(Server.mappath("~/app_data/uploads"), filename);
file.saveas(path);
}
return RedirectToAction("index");
}
Run Code Online (Sandbox Code Playgroud)