I have an asp.net web application that shows photos from various sets. The files are on server and file locations stored in SQL database. I use the following code for getting the first image:
System.Drawing.Image img = System.Drawing.Image.FromFile(fileLocation);
string imageName = "~/Images/hw.jpg";
string savePath = Server.MapPath(@"Images\hw.jpg");
img.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
img_peq_main.ImageUrl = imageName;
What I want is to retrieve the file name from the database using ajax. But the above code does not work on server-side with ajax request. How can I save the file to the Images folder and bind that source to asp. Image control? Is there any more basic way to do this?
Appreciate for help.