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
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 is IFormFile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With