how to preview image before upload in asp.net c#



<asp:FileUpload ID="fuImage" runat="server" onchange="ShowpImagePreview(this);" />
 


<img src="" alt="" id="imgAuthor" width="180px" height="210px" style="margin-top: -35%; border: 2px solid white; border-radius: 90px;" />
 





function ShowpImagePreview(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#imgAuthor').attr('src', e.target.result);
                }
                reader.readAsDataURL(input.files[0]);
            }
        }

No comments:

Post a Comment