Answer below is about beta6 version.
It is now in the framework.
With some caveats so far, to get the uploaded file name you have to parse headers. And you have to inject IHostingEnvironment in your controller to get to wwwroot folder location, because there is no more Server.MapPath()
Take this as example:
public class SomeController : Controller
{
private readonly IHostingEnvironment _environment;
public SomeController(IHostingEnvironment environment)
{
_environment = environment;
}
[HttpPost]
public ActionResult UploadFile(IFormFile file)//, int Id, string Title)
{
if (file.Length > 0)
{
var targetDirectory = Path.Combine(_environment.WebRootPath, string.Format("Content\\Uploaded\\"));
var fileName = GetFileName(file);
var savePath = Path.Combine(targetDirectory, fileName);
file.SaveAs(savePath);
return Json(new { Status = "Ok" });
}
return Json(new { Status = "Error" });
}
private static string GetFileName(IFormFile file) => file.ContentDisposition.Split(';')
.Select(x => x.Trim())
.Where(x => x.StartsWith("filename="))
.Select(x => x.Substring(9).Trim('"'))
.First();
}