title: FileReader API 'load' event
body: <p>I am currently working on a Unity Webgl project and I am new to javascript and web .</p>
  
  <p>In my project the user have to be able to add pictures and videos to the the webgl player, picture works fine (thanks to gman's code on this <a href="https://stackoverflow.com/questions/35183253/unity3d-upload-a-image-from-pc-memory-to-webgl-app?rq=1">thread</a>). I use it as a base for my script. Of course I have changed the input accept to be able to get video (mp4 only). But I am getting some trouble.</p>
  
  <p>I have read this <a href="http://www.html5rocks.com/en/tutorials/file/dndfiles/" rel="nofollow noreferrer">tutorial</a> and all the doc I have found about javascript File, Blob, etc. But I didn't make it work. I believe there is something I don't understand with <code>FileReader</code> since the <code>console.log</code> on the <code>"load"</code> listener is never called, same for the <code>"onerror"</code> listener except when I click on cancel (from the code <a href="https://stackoverflow.com/questions/35183253/unity3d-upload-a-image-from-pc-memory-to-webgl-app?rq=1">here</a>).</p>
  
  <pre><code>function getPic( evt ) {
      var file = document.querySelector( 'input[type=file]' ).files[0];
      var reader = new FileReader();
  
      reader.addEventListener( "onload", function () {
          reader.readAsDataURL( file );
          console.log( reader.result );
      }, false );
      reader.addEventListener( "onerror", function ( error ) {
          console.log( "error" + error );
      }, false );
  }
  </code></pre>
  
  <p>I have tried <code>onloadend</code> too but it don't work, since the <code>onload/onloadend</code> listener is never called my script print <code>"null"</code>. Is that a good beginning or is there a simpler way to get <code>video/image</code> from user computer ?</p>