0

In my application, the user will have the ability to upload documents.

It looks like this:

this

Now underneath I want a file preview and for pictures it works. However, when I try to preview PDF it shows this:

enter image description here

Here is my code:

<img id="output" height="200" width="200" 
     accept="'image/jpeg,image/gif,image/png,application/pdf'" />

<script>
  var loadFile = function (event) {
    var output = document.getElementById('output');
    output.src = URL.createObjectURL(event.target.files[0]);
  };
</script>

Is it because of the <img> tag? and it will only display images? Any help is appreciated.

thanksd
  • 54,176
  • 22
  • 157
  • 150
Grizzly
  • 5,873
  • 8
  • 56
  • 109

0 Answers0