jQuery File Input Image Preview Before It Is Uploaded
Image preview before submit
<form id="form1" runat="server"> <input type='file' id="inputFile" /> <img id="image_upload_preview" src="http://placehold.it/100x100" alt="your image" /> </form>
function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#image_upload_preview').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } $("#inputFile").change(function () { readURL(this); });
jQuery File Input Image Preview Before It Is Uploaded
Reviewed by Bhaumik Patel
on
7:26 AM
Rating: