"Photo file upload"
Bootstrap 4.1.1 Snippet by KrishnaPraveenVemuri

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/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"> <div> <label class=newbtn> <img id="blah" src="http://placehold.it/120x120" > <input id="pic" class='pis' onchange="readURL(this);" type="file" > </label> </div> </div> </div> <script> $('.newbtn').bind("click" , function () { $('#pic').click(); }); 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]); } } </script> <style> #pic{ display: none; } .newbtn{ cursor: pointer; } #blah{ max-width:100px; height:100px; margin-top:20px; } </style>

Related: See More


Questions / Comments: