In my application, the user will have the ability to upload documents.
It looks like this:
Now underneath I want a file preview and for pictures it works. However, when I try to preview PDF it shows this:
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.