I'm getting an error on HttpPostedFileBase
:
The type or namespace name 'HttpPostedFileBase'could not be found(are you missing a using directive or an assembly reference?)
I have already tried to use using System.Web
but didn't work at all.
Edit #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");
}
I dont acctually have a reference folder No references folder
Best Answer
You can't mix and match tutorials and framework versions. You're on ASP.NET Core 2.0.8, which doesn't contain
HttpPostedFileBase
.The ASP.NET Core counterpart of
HttpPostedFileBase
isIFormFile
.