title: Jquery promises whit objects
body: <pre><code>function uploadfiles(inputcontrol){ 
     //here the function takes all the files of an input files
     //for each inputcontrol.files[i]
     //createObject(inputcontrol.files[i]);
  }
  
  function createObject(files){ 
    //this function creates an object with each one of them the files 
    //are processed and loaded in a web service whit AJAX
  }
  
  when(uploadfiles()).then(alert('All files uploaded'));
  </code></pre>
  
  <p>When I run this script, the alert is displayed immediately and it does not wait for the files to be uploaded correctly. How should I run the $ .when?</p>