Wednesday, 8 October 2014

How to Show Image Preview Before Upload Image in Asp.Net c#

No comments    
categories: , , , ,
IMAGE PREVIEW

Show Image PreView  before  Image Upload to  Database using Asp.Net C#

Multiple Image Upload
Image Update in Gridview   
Show Image Preview
Restrict Upload File Size
Image Insert Bind  GridView
Without Database Upload Image Show

                    DEMO






JavaScript Coding

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">

    function imagepreview(input) {
        if (input.files && input.files[0]) {
            var filerdr = new FileReader();
            filerdr.onload = function (e) {
                $('#Image1').attr('src', e.target.result);
            }
            filerdr.readAsDataURL(input.files[0]);
        }
    }
    </script>

Html Coding 


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

     <%-- Image Preview --%>

      <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">

    function imagepreview(input) {
        if (input.files && input.files[0]) {
            var filerdr = new FileReader();
            filerdr.onload = function (e) {
                $('#Image1').attr('src', e.target.result);
            }
            filerdr.readAsDataURL(input.files[0]);
        }
    }
    </script>


  <%--  Image PreView  --%>

</head>
<body>
    <form id="form1" runat="server">
    <div>
      
      
        <asp:FileUpload ID="FileUpload1" runat="server" onchange="imagepreview(this)"/>
        <asp:Image ID="Image1" runat="server" />
       
   
    </div>
    </form>
</body>
</html>









  

                                            

0 comments:

Post a Comment