"File Upload Preview"
Bootstrap 4.0.0 Snippet by SirawichDev

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <input type='file' onchange="readURL(this);" /> </div> <img id="blah" src="http://placehold.it/180" alt="your image" /> </div>
img{ max-width:100px; height:100px; margin-top:20px; } input{ margin-top:20px; }
function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#blah') .attr('src', e.target.result); }; reader.readAsDataURL(input.files[0]); } }

Related: See More


Questions / Comments: