Show an image preview before upload
Here’s a quick example that makes use of the URL.createObjectURL to render a thumbnail by setting the src attribute of an image tag to a object URL: The html code: <input accept=”image/*” type=”file” id=”files” /> <img id=”image” /> The JavaScript code: document.getElementById(‘files’).onchange = function () { var src = URL.createObjectURL(this.files[0]) document.getElementById(‘image’).src = src } The … Read more