title: cant populate a list in a Foreach Request.Files loop?
body: <p>i'm having issues adding items to a list with the foreach loop iterating through Request.Files. it seems to only add the last object in the list? even though my database is saving the entries of all the files, and the individual files are getting saved also.</p>
  
  <p>here's the controller code that i am posting to (from dropzone.js):</p>
  
  <pre><code>public ActionResult SaveDropzoneJsUploadedFiles()
  {   
      List&lt;FileObject&gt; files = new List&lt;FileObject&gt;();
  
      foreach (string fileName in Request.Files)
      {
          HttpPostedFileBase file = Request.Files[fileName];
  
          // custom file object
          var uploadFile = new FileObject();
  
          // files come through, i get the name
          uploadFile.Name = file.FileName;
  
          // add to list (only adds last object?)
          files.Add(uploadFile);
  
          // files save 
          file.SaveAs(uploadFile.Path);
          // db context saves
          db.Files.Add(uploadFile);
          db.SaveChanges();
      }
  }
  </code></pre>
  
  <p>the fileObject class is as follows:</p>
  
  <pre><code>    public class FileObject
      {
          public string Name { get; set; }
          public string Description { get; set; }
          public string Path { get; set; }
          public string Type { get; set; }
          public int Size { get; set; }
          public string Hash { get; set; }
      }
  </code></pre>