title: jQuery - post request with image using ASP.NET MVC controller
body: <p>How do I send FormData to a controller? I am trying to upload an image:</p>
  
  <pre><code>$(".Replybtn").on("click", function() {
  
    var fileData = new FormData();
    var files = $(".Rfile[data-id=" + RId + "]").get(0).files;
  
    if (files.length &gt; 0) {
      fileData.append("HelpSectionImages", files[0]);
    }
  
    $.post('/QJN/Reply/', {
      __RequestVerificationToken: gettoken(),
      TGID: RId,
      SID: UId,
      Com: cmnt
    }, function(data) {
      if (data == "Tagged") {
        // 
      }
    });
  
  });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;input type="file" class="Rfile" data-id=@feed.TagId accept = "image/*,video/*"&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>   [HttpPost, ValidateAntiForgeryToken, ValidateInput(enableValidation: true)]
      public ActionResult Reply(string TGID, string SID, string Com)
      {
       var file = Request.Files["HelpSectionImages"]; 
        if(file!=null){
  
         }
       }
  </code></pre>