"Upload File"
Bootstrap 3.3.0 Snippet by extreme

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ----------> <input type="file" name="imageUpload" id="imageUpload" class="hide"/> <label for="imageUpload" class="btn btn-large">Select file</label><br/><br/><br/> <img src="" id="imagePreview" alt="Preview Image" width="200px"/>
.hide{display:none;} .btn { display: inline-block; padding: 4px 12px; margin-bottom: 0; font-size: 14px; line-height: 20px; color: #333333; text-align: center; vertical-align: middle; cursor: pointer; border: 1px solid #bbbbbb; border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border-bottom-color: #a2a2a2; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .btn { border-color: #c5c5c5; border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); } .btn-large { padding: 11px 19px; font-size: 17.5px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
$('#imageUpload').change(function(){ readImgUrlAndPreview(this); function readImgUrlAndPreview(input){ if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#imagePreview').attr('src', e.target.result); } }; reader.readAsDataURL(input.files[0]); } });

Related: See More


Questions / Comments: