title: Chrome FileReader
body: <p>Can someone give me an example of using the FileReader API go get contents of a file in chrome?</p>
  
  <p>It seems to be returning <code>undefined</code> for me.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;script&gt;
  function handle_files(files) {
    console.log(files)
    reader = new FileReader()
    ret = []
    for (i = 0; i &lt; files.length; i++) {
      file = files[i]
      console.log(file)
      text = reader.readAsText(file) //readAsdataURL
      console.log(text) //undefined
      ret.push(text)
    }
    console.log(ret) // [undefined]
  
  }
  &lt;/script&gt;
  &lt;body&gt;
  FileReader Test
  &lt;input type="file" onchange="handle_files(this.files)"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>