File upload .NET Core 'IFormFile' does not contain a definition for 'SaveAsASync' and no extension method
<p>I'm trying to upload a file using ASP.NET Core Web Api. 
As many i found this code: </p>

<pre><code>namespace ModelBindingWebSite.Controllers
{
  public class HomeController : Controller
  {
    private IHostingEnvironment _environment;

    public HomeController(IHostingEnvironment environment)
    {
        _environment = environment;
    }
    public IActionResult Index()
    {
        return View();
    }

    [HttpPost]
    public async Task&lt;IActionResult&gt; Index(ICollection&lt;IFormFile&gt; files)
    {
        var uploads = Path.Combine(_environment.WebRootPath, "uploads");
        foreach (var file in files)
        {
            if (file.Length &gt; 0)
            {
                var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
                await file.SaveAsAsync(Path.Combine(uploads, fileName));
            }
        }
        return View();
    }
}
</code></pre>

<p>I get the error <code>IFormFile</code> does not contain a definition for <code>SaveAsASync</code> and no extension method.
Any idea?</p>