title: Submitting multiple files to ASP.NET controller accepting an ICollection<IFormFile>
body: <p>In my ASP.NET Core backend, I have a controller function that looks like this:</p>
  
  <pre><code>[HttpPost]
  [Route("documents/upload")]
  public async Task&lt;IActionResult&gt; UploadFile(ICollection&lt;IFormFile&gt; files)
  {
     ...
  }
  </code></pre>
  
  <p>In my front-end, I call the function like this:</p>
  
  <pre><code>var postSettings = {
      method: 'POST',
      credentials: 'include',
      mode: 'cors'
  }
  uploadDocuments( files ) {
      var data = new FormData();
      data.append('files', files);   
      postSettings.body = data;
  
      return fetch(endPoint + '/documents/upload', postSettings);
  }
  </code></pre>
  
  <p>If "files" is a single file - not an array with one file, but a single File object - <code>UploadFile</code> is called with an <code>ICollection&lt;IFormFile&gt;</code> containing the single file.</p>
  
  <p>If "files" is a list of files, either a FileList or an array of File objects, <code>UploadFile</code> is called with an empty <code>ICollection&lt;IFormFile&gt;</code>.</p>
  
  <p>How do I submit a list of files in such a way that they can be parsed as an <code>ICollection&lt;IFormFile&gt;</code>?</p>