title: how to Get input type file value from bootstrap model in mvc 5 controller using jquery ajax
body: <p>I'm trying to get the input type file value in MVC 5 C# controller but unable to get the value. I'm using bootstrap model and JQuery Ajax to do this task. And i Dont use form submit for this. following is my code.</p>
  
  <p>bootstrap model code : </p>
  
  <pre><code>&lt;div class="modal-content"&gt;
                  &lt;div class="modal-header"&gt;
                      &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                      &lt;h4&gt;Mark Chargeback&lt;/h4&gt;
                  &lt;/div&gt;
                  &lt;div class="modal-body" align="center"&gt;
                      &lt;div&gt;
                          &lt;input type="file" id="fdocs" class="form-control" style="margin-top: 5px;"/&gt;                           
                          &lt;input type="submit" id="btngetdocs" class="btn btn-success" value="Submit" style="margin-top: 5px;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>JQuery Ajax code :</p>
  
  <pre><code> $('#btngetdocs').click(function () {
              var docs = $('#fdocs').val();
              //alert(docs);
                  $.ajax({
                      type: "POST",
                      url: "../CS/GetDocs",
                      data: '{checkimg:"' + docs + '"}',
                      mimeType: "multipart/form-data",
                      contentType: 'application/json',
                      dataType: "json",
                      success: function (data) {
                          alert(data);
                          $('#myModal').modal('hide');
                      },
                      error: function () {
                          alert(data);
                      }
                  });
          });
  </code></pre>
  
  <p>MVC Controller Code :</p>
  
  <pre><code>        [HttpPost]
          public ActionResult GetDocs(HttpPostedFileBase checkimg)
          {
              try
              {
                  int result = DOCs(checkimg);
                  if (result &gt; 0)
                  {
                      return Json("Docs upload Successfully.");
                  }
                  else
                  {
                      return Json("Please Try again.");
                  }
              }
              catch (Exception ex) { return Json(ex.ToString()); }
          }
  </code></pre>
  
  <p>So please rid me out from this problem. </p>