title: How get the length of FormData object
body: <p>I'm using ajax to upload files.
  To pass and save the data I'm using the FormData object.
  I would like to show the length of the FormData object but I can not do it.</p>
  
  <p>I tried in this ways</p>
  
  <pre><code> var data = new FormData();
   jQuery.each($(this)[0].files, function(i, file) {
       data.append('img['+i+']', file);
   });
  
   /* FIRST */
   var getObjectSize = function(obj) {
      var leng = 0, key;
      for (key in obj) {
        if (obj.hasOwnProperty(key)) leng++;
      }
      return leng;
   };
   var items = getObjectSize(data);
   alert(items); // output 0
  
   /* SECOND */
   var items = Object.keys(data).length;
   alert(items); // output 0
  </code></pre>
  
  <p>How can I do this? Thanks.</p>