title: List of multiple files to upload as IEnumerable<HttpPostedFileBase>
body: <p>I want to upload multiple files in list of dynamic form. My model is like </p>
  
  <pre><code>class mymodel
  {
      public IEnumerable&lt;FileAttachmentViewModel&gt; FileAttachments { get; set; }
  }
  
  public class FileAttachmentViewModel
  {
      [DataType(DataType.Upload)]
      public IEnumerable&lt;HttpPostedFileBase&gt; files { get; set; }
      public bool IsPrivate { get; set; }
      public string Description { get; set; }
  }
  </code></pre>
  
  <p>but my controller returns <code>null</code> for files</p>
  
  <p>my view</p>
  
  <pre><code>&lt;div class="panel panel-default"&gt;
      &lt;div class="panel-heading"&gt;
          File 1
          &lt;button type="button" style="margin-bottom:10px;" class='pull-right btn btn-success add-file'&gt;&lt;span class="glyphicon glyphicon-plus"&gt;&lt;/span&gt;Add File &lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="panel-body"&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="label-control col-md-3"&gt; Select File &lt;/label&gt;
              &lt;input type="file" class="form-control col-md-4" name="FileAttachments[0][files]" multiple="multiple" /&gt;
              &lt;label class="label-control col-md-2"&gt; IsPrivate &lt;/label&gt;
              &lt;input type="checkbox" name="FileAttachments[0][IsPrivate]" class="col-md-3" value="true"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="label-control col-md-3"&gt; Description &lt;/label&gt;
              &lt;textarea name="FileAttachments[0][Description]" class="form-control col-md-9"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="fileupload"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>its a dynamic view with javascript.
  and my controller</p>
  
  <pre><code>public ActionResut Register(myviewmodel model)
  {
      if (model.FileAttachments != null)
      {
          foreach (var att in model.FileAttachments)
          {
              if (att.files != null)
              {
                  foreach (HttpPostedFileBase file in att.file)
                  {
                      var fileName = Path.GetFileName(file.FileName);
                      attachment = new Attachment();
                      attachment.AttachmentId = Guid.NewGuid();
                      attachment.Description = att.Description;
                      attachment.URL = "~/Content/Heritage/Attachments/" + fileName;
                      attachment.Type = file.ContentType;
                      attachment.HeritageId = heritage.HeritageId;
                      //attachment.OtherType = model.OtherType;
                      attachment.IsPrivate = att.IsPrivate;
                      _AttachmentService.Insert(attachment);
                      file.SaveAs(Path.Combine(Server.MapPath("~/Content/Heritage/Attachments/" + fileName)));
                  }
              }
          }
      }
  }
  </code></pre>