title: Javascript FileReader on IE8
body: <p>I have this javascript function which shows a preview after user picked an image. My problem is that it's not working on IE and I do not figure out why.</p>
  
  <p>No error, but input.files is null.</p>
  
  <p>The JavaScript</p>
  
  <pre><code>function showimagepreview(input, previewId) {
      if (input.files &amp;&amp; input.files[0]) {
          var filerdr = new FileReader();
          filerdr.onload = function (e) {
              $('#' + previewId).attr('src', e.target.result);
          }
          filerdr.readAsDataURL(input.files[0]);
      }
  }  
  </code></pre>
  
  <p>this is my HTML code</p>
  
  <pre><code>&lt;div class="photo" id="photo-1"&gt;
      &lt;input type="file" class="upload-file" name="Photos[1]" onchange="showimagepreview(this, 'photosPreview1')" /&gt;
      &lt;img id="photosPreview1" class="PhotoPreview" /&gt;
  &lt;/div&gt;
  </code></pre>