title: Formdata object is converting into querystring in ASP.NET MVC
body: <p>I am sending formdata data to an MVC controller, but when I send the request sometimes the formdata is converted into querystring or missing some values.</p>
  
  <p>When I debug my code in Chrome the request is sent to the server but sometimes it will not include cityid and image in the request.</p>
  
  <p>This is my jQuery add function:</p>
  
  <pre><code>   function add()
      {
  
          var formdata = new FormData(); 
          var imagefile = $('#imageuploaded')[0].files[0];
  
          formdata.append('name', $('#name').val());
          formdata.append('lastname', $('#lastname').val());
          formdata.append('address', $('#address').val());
          formdata.append('imageuploaded', imagefile);
  
          for (var i = 0; i &lt; formvalues.cityid.length; i++)
          {
              formdata.append('cityid['+i+']', formvalues.cityid[i]);
  
          }
  
          $.ajax({
  
              url: "/Practice/insertemployee",
              type: "Post",
              contentType: false,
              processData: false,
              data: formdata,
              success: onsccessinsert,
              error:onerrorinsert
  
          });
      }
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code> public JsonResult insertemployee(People people,HttpPostedFileBase 
  imageuploaded)
      {
           var name= imageuploaded.FileName;
           var folderpath = Server.MapPath(@"\Images\");
          string guid = new Guid().ToString();
          var fullpath = folderpath +guid+ name;
          people.fullimagepath = fullpath;
          people.shortimagepath=@"\Images\"+guid+name;
          imageuploaded.SaveAs(fullpath);
          return Json(PracticedbcontexController.insertintodb(people), JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>And finally, the view markup:</p>
  
  <pre><code>&lt;form id="peopleform"   enctype="multipart/form-data" &gt;
  &lt;div class="form-group"&gt;
          &lt;input type="hidden" id="id" /&gt;
          &lt;label&gt;name&lt;/label&gt;
          &lt;input type="text" class="form-control" id="name" name="name" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label&gt;lastname&lt;/label&gt;
          &lt;input type="text" class="form-control" id="lastname" name="lastname" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label&gt;address&lt;/label&gt;
          &lt;input type="text" class="form-control" id="address" name="address" /&gt;
      &lt;/div&gt;
      &lt;select id="listofcities"  onchange="citiesselected()"&gt;
          &lt;option value="1"&gt;karachi&lt;/option&gt;
          &lt;option value="2"&gt;hyderabad&lt;/option&gt;
          &lt;option value="3"&gt;larkana&lt;/option&gt;
      &lt;/select&gt;
      &lt;div class="form-group"&gt;
          &lt;input type="file" id="imageuploaded" name="imageuploaded" class="form-control" /&gt;
      &lt;/div&gt;
      &lt;ul id="cityid"&gt;&lt;/ul&gt;
      &lt;button id="submitform" class="btn btn-primary" onclick="add()"&gt;submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When I send the request to the server, the request is converted into query string instead of formdata object. When I debug and send the request it appears to be missing some data. I have inspected all the values are attached to formdata.</p>