title: How to upload picture from Phonegap mobile app using AJAX?
body: <p>I have Phonegap mobile app and I am using Camera API to capture picture using this code:</p>
  
  <pre><code>navigator.camera.getPicture(function(data){
    $.post('http://www.example.com', {data:data});
  }, function(msg){alert(msg);}, { quality: 20 });
  </code></pre>
  
  <p>This would be OK, but there is need to set the quality option to some reasonable value depending on mobile device used. Some can handle values higher than 70, but low-end devices have troubles even with the value of 20. Phonegap documentation mentions these problem, that they are caused by memory needed since the whole picture is stored in Base64 string. Phonegap suggests to rather specify option <code>destinationType: Camera.DestinationType.FILE_URI</code></p>
  
  <p>But as far as I understand this, I would get local filepath of the stored picture, which I would have to read it into one variable using FileReader API. And then <code>$.post</code>it again the same way as I am doing right now.</p>
  
  <p>To me, it seems, that if I would change the destinationType from Base64 to FILE_URI, I wouldn't gain anything and still have the same memory issues when reading it from the local file to variable and POSTing it.</p>
  
  <p>Is my thinking right ? Or am I missing something and there would be some advantage of using FILE_URI destionationType ? Or is there a better way how to upload taken picture ?</p>