Click here to Skip to main content
12,761,078 members (31,657 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET

I have image control on my page. I want to save image from image control on server.
I have already seen
Save image to a folder from an asp:Image control[^]


problem with this link is its not reading from ImageControl(asp:Image), i have to read it from ImageControl, because my image source is coming from jquery not from code, and i dont want to use jquery as i want to do some more image processing using

Thanks in advance
Posted 7-Dec-12 0:58am
Updated 7-Dec-12 1:15am
choudhary.sumit 7-Dec-12 6:13am
so what is the problem. on which event u want to do so?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this, I hope it may help you
protected void btnUpload_Click(object sender, EventArgs e)
      string filename;
      string ImageFileName;
      if (pics.HasFile)
          filename = System.IO.Path.GetFileName(pics.FileName);
          pics.SaveAs(Server.MapPath("/Galery/") + filename);
          ImageFileName = "/Galery/" + filename;
      SqlConnection Conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["myConnectionString"]);
      SqlCommand CatCmd = Conn.CreateCommand();
          CatCmd.CommandText = "insert into PhotoGaleryImage(CatagoryId,Path,UserId) values('CatagoryID','ImageFileName','userId')";
      catch (Exception) { }
          if (Conn != null && Conn.State == ConnectionState.Open)

*Galary should be one of your folder included in the solution
*pics is the Fileupload control

Keep smiling :):):) happy coding:)
sunil_mali 7-Dec-12 6:26am
Thanks for your reply,

but my trouble is i don't have file upload control in my page.
I just have one image control whose source is determined by jquery code..
i want to read file name from this image control or somehow i want to store image from image control to servers folder...
i don't know jquery i want to use csharp code for saving it.

again thanks for you reply... see if u can help me with this..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100