Saving image Session ASP.Net C#

Posted by Raja_89 under ASP.NET on 4/1/2013 | Points: 10 | Views : 4725 | Status : [Member] | Replies : 4
Hai
Is it possible to store an image in session in asp.net C#
How can i display an image in another page which is stored in sql server




Responses

Posted by: Jayakumars on: 4/1/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
try this code

protected void bt_Submit_Click(object sender, EventArgs e)
{
if (!fup1.HasFile)
{

}
else
{
HttpPostedFile http = fup1.PostedFile;
Response.Write(http.FileName);
}
}

<asp:UpdatePanel ID="up1" runat ="server" >
<ContentTemplate>
<asp:FileUpload ID="fup1" runat ="server" />
<asp:Button ID="bt_Submit" runat ="server" Text ="Submit"
onclick="bt_Submit_Click" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID ="bt_Submit" />
</Triggers>
</asp:UpdatePanel>

Mark as Answer if its helpful to you

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 4/1/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
www.c-sharpcorner.com/UploadFile/satyapriyanayak/display-username-along-with-photo-after-successful-login/

If this post helps you mark it as answer
Thanks

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jenniffer on: 4/3/2013 [Member] Starter | Points: 25

Up
0
Down
static string photoPath = HttpContext.Current.Server.MapPath(".");

In Button Click:

string FileUp = Txt_FileUpload.FileName;
Session["Images"] = FileUp;
try
{
if (Txt_FileUpload.HasFile)
{
Txt_FileUpload.SaveAs(MapPath("~/ImageFolder/" + Txt_FileUpload.FileName));
System.Drawing.Image img1 = System.Drawing.Image.FromFile(MapPath("~/ImageFolder/") + Txt_FileUpload.FileName);
imname = @"\ImageFolder\" + "_" + FileUp;
Images = imname.ToString();
}

}
catch (Exception ex)
{
}


and den use tat image name in another page like this....

string ImageName = Session["Images"].Tostring();

Mark as Answer if its helpful to you...

Thanks & Regards
JENI

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 4/30/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi,
Please refer below link that would be helpful for you while updating image into database-
http://www.codeproject.com/Articles/9686/Save-An-Image-Into-SQL-Server-2000-Database

Jitendra Kumar
If my post helps you, plz mark as an answer.

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response