Answer the question
In order to leave comments, you need to log in
Why don't HttpPostedFileBase file and Request.File exist? How to upload a file in C#?
How to upload a file to Aps Net Core server?
I'm trying as they say, but HttpPostedFileBase file and Request.File don't exist?
What needs to be connected to receive files?
[HttpPost]
public ActionResult Index(IEnumerable<HttpPostedFileBase> files) {
foreach (var file in files) {
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");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question