Код контроллера:
Код: Выделить всё
[HttpPost]
public async Task File([FromForm] IFormFile file)
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", file.FileName);
using (var stream = new FileStream(path, FileMode.Create))
{
await file.CopyToAsync(stream);
}
return Content($"File uploaded");
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... eturn-null