HTML script
<html> <head> <script type="text/javascript"> function preview_image(event) { var reader = new FileReader(); reader.onload = function() { var output = document.getElementById('output_image'); output.src = reader.result; } reader.readAsDataURL(event.target.files[0]); } </script> </head> <body> <form method="POST" action="" enctype="multipart/form-data"> <input type="file" name="abc" accept="image/*" onchange="preview_image(event)"> <button type="submit" name="submit_form_button" >Submit</button> <img id="output_image" width="90%"/> </form> </body> </html> ~
References