Source Code:
(back to article)
Submit
Result:
Report an issue
<input type="file" id="imageInput" /> <div>Select an image file, please.</div> <img id="imageDisplay" /> <script> document.getElementById('imageInput').addEventListener('change', function(event) { const file = event.target.files[0]; const reader = new FileReader(); reader.onload = function(e) { document.getElementById('imageDisplay').src = e.target.result; }; reader.readAsDataURL(file); }); </script>