title: Not able to upload file using Ajax.BeginForm() asynchronously
body: <p>I'm trying to upload a file using Ajax.BeginForm(), but it's not working out.</p>
  
  <p>My view contains:</p>
  
  <pre><code>@using (Ajax.BeginForm("UploadFile", null, new AjaxOptions { HttpMethod="POST",     UpdateTargetId = "result" }, new { enctype = "multipart/form-data" }))
  {
     &lt;label id="lblUploadNewFile" for="fileUploadControl"&gt;Upload New File&amp;lt;/label&gt;
     &lt;input type="file" name="fileToUpload" id="fileUploadControl"/&gt;
     &lt;input id="btnFileUpload" type="submit" value="Upload" /&gt;
     &lt;span id="result" /&gt;
  }
  </code></pre>
  
  <p>and the corresponding Controller is:</p>
  
  <pre><code>[HttpPost]
  public string UploadFile(FormCollection formData)
  {
     HttpPostedFileBase file=null;
  
     try
     {
        file = Request.Files[0];
     }
     catch { }
  
     if ( file!=null &amp;amp;&amp;amp; file.ContentLength &amp;gt; 0)
     {
        file.SaveAs(string.Concat(
              AppDomain.CurrentDomain.BaseDirectory,
              Path.GetFileName(file.FileName)));
  
        return &amp;quot;Successfully Uploaded&amp;quot;;
     }
     else
     {
        return &amp;quot;Upload Failed, please try again.&amp;quot;;
     }
  }
  </code></pre>
  
  <p>The problem is that it's uploading the file, but no longer doing any asynchronous posts when I remove <code>jquery.unobtrusive-ajax.js</code>. Instead, it does a full post-back.</p>
  
  <p>When I add <code>jquery.unobtrusive-ajax.js</code> in my view, it's doing it asynchronously, but it is not sending an upload file in the form data. No file is being sent to the server in <code>Request.Files[]</code>.</p>