Click here to Skip to main content
15,904,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to save any image which i want to save in specified directory..I have used the follwoing code but it is giving exception...

  string path = GetImgURL(Picture_id);
       System.Drawing.Image _sourceImage =     System.Drawing.Image.FromFile(Server.MapPath(path));
System.Drawing.Image _thumbImage = this.CreateThumbnail(_sourceImage, 40, 40);
_thumbImage.Save("~\\Uploads/_thumbImage", ImageFormat.Jpeg);
Posted
Comments
Toniyo Jackson 8-Jun-11 6:11am    
What is that exception?

Try this :

string filename = Path.GetFileName(fileupload1.FileName);
string filepath = "~/albums/" + filename;
fileupload1.SaveAs(Server.MapPath(filepath));
 
Share this answer
 
Comments
touseef4pk 8-Jun-11 6:21am    
this code did not work as Here I have an image which i have converted into thumbnail and then want to save that thumbnail to physical location
thanks this code worked for me !

string path = GetImgURL(Picture_id);
            System.Drawing.Image _sourceImage = System.Drawing.Image.FromFile(Server.MapPath(path));
            System.Drawing.Image _thumbImage = this.CreateThumbnail(_sourceImage, 40, 40);

           _thumbImage.Save( Server.MapPath("~") +"\\Uploads/Day.gif", ImageFormat.Jpeg)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900