How to Upload Image Files without Refreshing Page using jquery
Below is the code for Uploading image without Refreshing Page using jquery:-
———————-
<head runat=”server”>
<title></title>
<script type=”text/javascript” src=”http://code.jquery.com/jquery-1.8.2.js”></script>
<script type=”text/javascript”>
function ShowpImagePreview(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$(‘#ImgPrv’).attr(‘src’, e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<fieldset style=”width: 270px;”>
<div align=”center”>
<asp:Image ID=”ImgPrv” Height=”150px” Width=”240px” runat=”server” /><br />
<asp:FileUpload ID=”flupImage” runat=”server” onchange=”ShowpImagePreview(this);” />
</div>
<asp:Button runat=”server” Text=”Submit” OnClick=”Unnamed1_Click” />
</fieldset>
</div>
</form>
</body>
</html>