jquery - Display image in ASP -
i have file upload control want when choose image want display in asp panel through jquery how this
<div id="crop-header"> <asp:fileupload cssclass="cropit-image-input" id="fileupex" runat="server" width="100%" /> </div> <asp:panel id="pnlcrop" runat="server" cssclass="cropit-preview"> </asp:panel> </div> any solution?
you can use filereader that.
<asp:fileupload id="fileupload1" runat="server" accept=".bmp,.gif,.jpg,.jpeg,.png" /> <img id="imagepreview" class="imagepreview" style="max-height: 100px; display: none" /> <script type="text/javascript"> $("#<%=fileupload1.clientid %>").change(function () { showimagepreview(this); }); function showimagepreview(control) { if (control.files && control.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('#imagepreview').attr('src', e.target.result); $("#imagepreview").show(); } reader.readasdataurl(control.files[0]); } } </script>
Comments
Post a Comment