title: C# getting all files in request.file
body: <p>I am trying to upload a group of files, however when i loop through the files only the first file is ever saved, despite being looped through the correct number of times. So i can only upload the first file, not multiple files if they have been selected.</p>
  
  <p>I have this code I have seen in a couple of examples. </p>
  
  <pre><code>        foreach (string fileName in Request.Files)
          {
              HttpPostedFileBase file = Request.Files[fileName];
              //Save file content goes here
              fName = file.FileName;
  </code></pre>
  
  <p>Here is the Html,</p>
  
  <pre><code>@using (Html.BeginForm("SaveFile", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
  {
      &lt;div class="well"&gt;
  
          &lt;textarea rows="10" cols="50" class="ListOfFiles" placeholder="No files Chosen"&gt;&lt;/textarea&gt;
  
          &lt;div class="fallback"&gt;
              &lt;div class="well"&gt;
                  &lt;input name="files" type="file" multiple value="Files" id="ImageFile"  /&gt;
              &lt;/div&gt;
              &lt;input type="submit" value="Save Files" /&gt;
              @ViewBag.Message
          &lt;/div&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>the variable filename is always equal to "files" which is the name of the file input tag, but as mentioned, this always just gives back the first file selected. How do I make the loop go through all the files properly?</p>