Image Show on change of fileupload
- <head runat="server">
- <title>Preview Image While Upload</title>
- <script src="jquery-1.8.2.js" type="text/javascript"></script>
- <script type="text/javascript">
- function ShowPreview(input) {
- if (input.files && input.files[0]) {
- var ImageDir = new FileReader();
- ImageDir.onload = function(e) {
- $('#impPrev').attr('src', e.target.result);
- }
- ImageDir.readAsDataURL(input.files[0]);
- }
- }
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <table cellpadding="10" cellspacing="4" width="70%" align="center" style="border: Solid 10px Green;
- font-weight: bold; font-size: 16pt; background-color: Skyblue; color: Blue;">
- <tr>
- <td align="center">
- Upload Images
- </td>
- </tr>
- <tr>
- <td>
- Select Your File To Upload #:
- <input type="file" name="ImageUpload" id="ImageUpload" onchange="ShowPreview(this)" />
- <asp:Button ID="btnUpload" runat="server" Text="Upload" />
- </td>
- </tr>
- <tr>
- <td>
- <asp:Image ID="impPrev" runat="server" Height="200px" />
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Comments
Post a Comment