title: FormData can't into the Server, what problem in my Code
body: <hr>
  
  <p>What can I do to send <strong>FormData</strong> to my <em>server</em>, my file is always null in server or return Unsupported  Media status 415, I try to solve the problem but have no idea now....</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" name="add_data" id="add_data" method="post" onsubmit="return false"   &gt;
      &lt;input type="file" multiple="multiple" name="files" value="" id="files" /&gt;
      &lt;br /&gt;
      &lt;input type="submit" class="btn btn-success" value="Upload"&gt;
      &lt;br /&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <hr>
  
  <p>this my html part and then 
  ajax</p>
  
  <pre><code>$('#add_data').submit(function () {
              var totalFiles; 
              totalFiles = document.getElementById("files").files[0];
              var formData = new FormData();
              formData.append("files", totalFiles);
              $.ajax({
                  url: "/api/food/addfile",
                  type: "Post",
                  data:myData,
                  contentType: false,
                  processData: false,
                  beforeSend: function (request) {
                      request.setRequestHeader("Authorization", "Bearer " + token);
                  },
                  data:  totalFiles ,
                  dataType: 'json',
                  success: function () {
                      alert("success")
                  },
                  error: function (jqXHR, exception) {
                      if (jqXHR.status == 401) {
                         return alert("請先執行前置作業");
                      }
                      alert(jqXHR.responseText);
                  }
              });
          });
  </code></pre>
  
  <hr>
  
  <p>and Controller </p>
  
  <pre><code>[Authorize]
      [HttpPost,Route("addfile")]
      public  IActionResult GetPicture(/*HttpPostedFileBase[] files*/)
      {
          #region test1
          //if (files != null)
          //{
  
          //    foreach (HttpPostedFileBase file in files)
          //    {
          //        file.SaveAs(Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/upload/"), file.FileName));
          //    }
          //}
          #endregion
  
          #region test2
  
          var req = System.Web.HttpContext.Current.Request;
          if (req.Files.Count &gt; 0)
          {
              foreach (string fileName in req.Files.Keys)
              {
                  var file = req.Files["files"];
                  file.SaveAs(Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/upload/"), file.FileName));
              }
          }
  
  
          #endregion
  
          return Json(new { Status = 1 &gt; 0 ? "SUCCESS" : "FAILS" });
  </code></pre>
  
  <hr>
  
  <p>that all Code , please who can tell me thanks.</p>