title: Jquery ajax form submit that contains files
body: <p>I have a very long form that contains files attachment:</p>
  
  <p>this is how my form looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/hscGB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hscGB.png" alt="enter image description here"></a></p>
  
  <p>The form will be submitted to this action:</p>
  
  <pre><code>[HttpPost]
  public ActionResult AddReceivingConfirm(DTOreceiving entry,IEnumerable&lt;HttpPostedFileBase&gt; fileUpload)
      {
  
          return PartialView();
      }
  </code></pre>
  
  <p>through ajax call which is:</p>
  
  <pre><code>$(document).on('click', 'input[type="submit"].genericSubmit', function () {                    //generic function for ajax submit of ANY FORMS t
  
          if (!$("form#ValidateForm").valid()) {
                  return false;
          };
  
  
          var frmData = $('.genericForm').serialize();
          var frmUrl = $('.genericForm').attr('action');
              $.ajax({
                type: 'post',
                url: frmUrl,
                data: frmData,
  
                success: function (e) {
                   $('#target').html(e);
               }
           });
           return false;
   });
  </code></pre>
  
  <p>everything is binding perfectly except the <code>IEnumerable&lt;HttpPostedFileBase&gt;</code>which always results to <code>null</code>,</p>
  
  <p>the file part of my form is done like this:</p>
  
  <pre><code> &lt;tr&gt;
   &lt;td&gt;Attachment #1: &lt;/td&gt;
   &lt;td colspan="3"&gt;
       &lt;input id="file1" type="file" name="fileUpload" /&gt;
   &lt;/td&gt;
  
   &lt;/tr&gt;
  
    &lt;tr&gt;
    &lt;td&gt;Attachment #2: &lt;/td&gt;
   &lt;td colspan="3"&gt;
       &lt;input id="file2" type="file" name="fileUpload" /&gt;
   &lt;/td&gt;
  
   &lt;/tr&gt;
  
    &lt;tr&gt;
    &lt;td&gt;Attachment #3: &lt;/td&gt;
   &lt;td colspan="3"&gt;
       &lt;input id="file3 "type="file" name="fileUpload" /&gt;
   &lt;/td&gt;
  
   &lt;/tr&gt;
  </code></pre>
  
  <p>I have tried the brackets version and etc but it won't bind.</p>
  
  <p>After an hour of researching, i've read that it's not possible(?) )to do file posting conventionally through the use of Ajax unless iframe. I am not sure of what my action will be, i kinda want to avoid using plugin so i wanna know if there is some "hacky" ways to access the files directly from my form?</p>
  
  <p>this is my form:</p>
  
  <pre><code>using (Html.BeginForm("AddReceivingConfirm", "Wms", FormMethod.Post, new { id = "ValidateForm", @class = "genericForm" , enctype="multipart/form-data"}))
  </code></pre>