title: Passing HttpPostedFileBase to Controller
body: <p>I am trying to pass an audio blob recorded in my view to my Controller. Following is what I have done so far.</p>
  
  <p>// Controller</p>
  
  <pre><code>[HttpPost]
  public ActionResult Record(TestAudio data)
  {
      return View();
  }
  </code></pre>
  
  <p>and TestAudio Data is as follows</p>
  
  <pre><code>public class TestAudio
  {
      public TestAudio()
      {
          UserDetails = new User();
  
      }
      public HttpPostedFileBase Sample;
      public User UserDetails;
  }
  
  public class User
  {
      string UserName;
  }
  </code></pre>
  
  <p>Jquery submit is as follows</p>
  
  <pre><code>$('#send').click(function () {
          var answer = {
              sample: recorded,  // Where recorded is a variable containing my blob
              userdetails : null
          }
  
          var data = new FormData();
          data.append("data", answer);
          debugger;
  
          $.ajax({
              type: 'POST',
              url: '../home/record',
              data: data,
              //contentType: 'application/my-binary-type', // set to whatever you like
              contentType: false,
              processData: false
      });
      });
  </code></pre>
  
  <p>However, am getting data as null in my controller. If i was to use a HttpPostedFileBase alone as the Controller parameter, it works. But when am using a complex parameter such as TestAudio, it fails.</p>
  
  <p>Could someone guide me ?</p>