title: Upload files with Phonegap: File Transfer Error: request body stream exhausted
body: <p>So what I am trying to do is to replicate the process of uploading images to my server (POST method) in PhoneGap using fileTransfer.</p>
  
  <p>For testing purposes I used Chrome's Postman Rest client and this is the configuration that works:</p>
  
  <p><img src="https://i.stack.imgur.com/MWfWz.png" alt="enter image description here"></p>
  
  <p>and here is the JS code for Phonegap:</p>
  
  <p>// imageData is the url to image (file:///var/mobile/...)</p>
  
  <pre><code>var options = new FileUploadOptions();
  options.fileKey = "media";
  options.fileName=imageData.substr(imageData.lastIndexOf('/')+1);
  options.mimeType="image/jpeg";
  
  var params = new Object();
  params.category = "/api/v1/category/testcat/";
  params.message = "Hello from iOS";
  options.params = params;
  
  var ft = new FileTransfer();
  ft.upload(imageData, encodeURI("http://mydomain.com/api/v1/post/"), win, fail, options);
  
  // win, fail
  </code></pre>
  
  <p>And the response:</p>
  
  <pre><code>2014-03-25 23:30:46.582 StarterApp[6103:6107] FileTransferError {
      body = "";
      code = 3;
      "http_status" = 0;
      source = "file:///var/mobile/Applications/3FEF7630-C089-4DF3-9618-EF9EEE0AD6FE/tmp/cdv_photo_002.jpg";
      target = "http://mydomain.com/api/v1/post/";
  }
  2014-03-25 23:30:46.584 StarterApp[6103:6107] File Transfer Error: request body stream exhausted
  </code></pre>
  
  <p>Any help would be VERY very much appreciated as I completely stuck:(</p>