title: uploading image asp.net Core
body: <p>i am new to ASP.net COre and i would like to upload a file ( an image) and store it in a secific Folder. ihave been following this tuto (<a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-2.2" rel="nofollow noreferrer">File uploads in ASP.NET Core</a>) but i dont know how to store it in a file it is just uploaded on the server
  this is the html :</p>
  
  <pre><code>&lt;form method="post" enctype="multipart/form-data" asp-controller="UploadFiles" asp-action="Index"&gt;
  &lt;div class="form-group"&gt;
      &lt;div class="col-md-10"&gt;
          &lt;p&gt;Upload one or more files using this form:&lt;/p&gt;
          &lt;input type="file" name="files" multiple /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;div class="col-md-10"&gt;
          &lt;input type="submit" value="Upload" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is the Controller</p>
  
  <pre><code>[HttpPost("UploadFiles")]
  public async Task&lt;IActionResult&gt; Post(List&lt;IFormFile&gt; files)
  {
  long size = files.Sum(f =&gt; f.Length);
  
  // full path to file in temp location
  var filePath = Path.GetTempFileName();
  
  foreach (var formFile in files)
  {
      if (formFile.Length &gt; 0)
      {
          using (var stream = new FileStream(filePath, FileMode.Create))
          {
              await formFile.CopyToAsync(stream);
          }
      }
  }
  
  // process uploaded files
  // Don't rely on or trust the FileName property without validation.
  
  return Ok(new { count = files.Count, size, filePath});
  }
  </code></pre>
  
  <p>and this is the class i am using</p>
  
  <pre><code>public interface IFormFile
  {
  string ContentType { get; }
  string ContentDisposition { get; }
  IHeaderDictionary Headers { get; }
  long Length { get; }
  string Name { get; }
  string FileName { get; }
  Stream OpenReadStream();
  void CopyTo(Stream target);
  Task CopyToAsync(Stream target, CancellationToken cancellationToken = null);
  }
  </code></pre>
  
  <p>i just need to store the image in a folder like :C:\Users\DESKTOP-1603\Desktop\GestionSyndic\GestionSyndic\src\WebApplication1\wwwroot\images\
   and change the name of the image thank you :D</p>