title: turn image into string from <input type="file">
body: <p>Is it possible to turn an image into a base64 string with these restrictions,</p>
  
  <ol>
  <li>Image is coming from <code>&lt;input type="file"/&gt;</code>    </li>
  <li>No internet connection</li>
  <li>Mobile Browser</li>
  </ol>
  
  <p>I know I can download an image and convert it using <code>&lt;canvas&gt;</code>, but is it possible to access the image before it's uploaded? If this is not possible I am going to write a PhoneGap plugin.</p>
  
  <p>Thanks!</p>
  
  <p>Edit-</p>
  
  <p>Got this working using the FileReader API. Here's the relivant code,</p>
  
  <pre><code>var reader = new FileReader();
  reader.onload = function(theFile) {
      var base64Image = theFile.srcElement.result;
  };
  
  // Read in the image file as a data URL.
  reader.readAsDataURL(image.fileElement.dom.files[0]);
  </code></pre>