how do i upload a image file uploader, image save in server path and pass image url in image but image not show
<table>
<tr>
<td width="210px" height="160px">
<asp:Image ID="imgMartyr" runat="server" Width="149px" Height="166px" ImageUrl="~/images/noimage.jpg" />
</td>
</tr>
<tr>
<td height="20px" style="text-align: center">
<asp:FileUpload ID="fuImageMartyr" runat="server" Width="100px" Height="24px" />
<asp:Button ID="btnImgMartyr" runat="server" Width="100px" Height="24px" OnClick="btnImgMartyr_Click" Text="Upload" />
</td>
</tr>
</table>
protected void btnImgMartyr_Click(object sender, EventArgs e)
{
if (fuImageMartyr.HasFile)
{
if (fuImageMartyr.PostedFile.ContentLength > 20480)
{
ShowMessage("Image size not grater than 20 KB");
}
else
{
string path = Server.MapPath("../images/") + fuImageMartyr.FileName;
fuImageMartyr.SaveAs(path);
ViewState["Filename"] = fuImageMartyr.FileName;
Stream fs = fuImageMartyr.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
ViewState["Image"] = bytes;
imgMartyr.ImageUrl = path;
ShowMessage("Image uploaded successfully");
}
}
}