title: How To Upload Multiple Files To Server Using Javascript
body: <p>I am using PhoneGap, and uploading a file (using a HTTP POST) like this,</p>
  
  <pre><code>function uploadSingleFile()
  {
      var ft = new FileTransfer();
      // set up parameters etc
      ft.upload(imageName, "http://serviceaddress/UploadFile.ashx", win, fail, options);
  }
  
  function win(r)
  {
      // success callback
  }
  </code></pre>
  
  <p>I am wanting to upload muliple files, so in the success callback I want to call the uploadSingleFile to move onto the next file.</p>
  
  <p>How can I store which file I am up to? I am using the localStorage to store the file names. So I would want to do this,</p>
  
  <pre><code>upload file localStorage.file0
  upload file localStorage.file1
  upload file localStorage.file2
  </code></pre>
  
  <p>So all I would need to do would be to store the number on the end, 0, 1, etc of where we are up to. Do I need to use a global variable? Seems messy.</p>
  
  <p>If only I could pass through to the success callback a number as a additional parameter?</p>