title: ASP.Net Core Access to the Path is Denied with IFormFile
body: <p>Just writing a simple ASP.NET Core WebAPI and when using a simple POST endpoint accepting IFormFiles:</p>
  
  <pre><code>        [HttpPost]
          public async Task&lt;List&lt;string&gt;&gt; Post(List&lt;IFormFile&gt; files)
          {
              long size = files.Sum(f =&gt; f.Length);
              List&lt;string&gt; result = new List&lt;string&gt;();
  
              Console.WriteLine(files.Count);
  
              foreach (var f in files)
              {
                  if (f.Length &gt; 0)
                  {
                      Directory.CreateDirectory("Resources");
                      using (var stream = new FileStream("Resources", FileMode.Create))
                      {
                          await f.CopyToAsync(stream);
                          result.Add(f.FileName);
                      }
                  }
              }
              return result;
          }
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>System.UnauthorizedAccessException: Access to the path
    'F:\Documents HDD\spec-backend\Resources' is denied</p>
  </blockquote>
  
  <p>I have looked into it and apparently it has something to do with my directory being readonly but I cannot figure out how to change this and even then the directory is being created by my ASP.NET controller anyway.</p>