title: Send multiple objects which contains files to WCF Service using AJAX
body: <p>I've been scratching my head for quite a few days now.</p>
  
  <p>I am trying to send a Javascript object to a WCF Service.
  My objective is to have a object with some properties (where one should be the file or its bytes) which I can send to the service.</p>
  
  <p>So far my javascript looks like this where I do the population and the call to the service:</p>
  
  <pre><code>            var data = new FormData();
              for (var i = 0; i &lt; files.length; i++) {
                  //data.append(files[i].name, files[i]);
                  var obj = {};
                  obj.Name = files[i].name;
                  obj.File = files[i];
                  obj.Dir = "testDir";
  
                  data.append(obj.Name, obj);
              }
  
              $.ajax({
                  type: 'POST',
                  url: "WCFService.svc/Upload",
                  data: JSON.stringify(data),
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (response) {
                      //Do something on success
                  }
              });
  </code></pre>
  
  <p>This is the service. It is not doing anything real yet, but once I can figure out how to upload the files using objects I will continue with the service's code.</p>
  
  <pre><code>        [OperationContract]
          [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
          public void Upload(object obj)
          {
              string qwe = "";
          }
  </code></pre>
  
  <p>At the moment, the service is being called, but no data is contained. the Obj is null once it reaches the Service.</p>
  
  <p>Any help appreciated!</p>