Click here to Skip to main content
11,490,973 members (62,727 online)
Rate this: bad
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
Edited 7-Dec-12 1:15am
choudhary.sumit at 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 Smile | :) Smile | :) Smile | :) happy codingSmile | :)
sunil_mali at 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
0 Sergey Alexandrovich Kryukov 521
1 Andy Lanng 288
2 Sascha Lefèvre 240
3 Maciej Los 195
4 OriginalGriff 163
0 Sergey Alexandrovich Kryukov 9,829
1 OriginalGriff 8,520
2 Sascha Lefèvre 3,574
3 Maciej Los 3,151
4 Richard Deeming 2,370

Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2015
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