Hello,
I have a website which allows the user to download the images from it. I used the following code. It download for most of the images but for some it tries to download as a file without extension. So can you please suggest what might be causing this.
thanks
Mythili
// Output standard image
DataRow romImage = DAImage.GetImageByID(imageID);
System.Drawing.Image image = GetImage(WebConfigurationManager.AppSettings["ImageLibraryPath"] + romImage["RelPath"]);
Response.Clear();
string extension = romImage["RelPath"].ToString().Substring(romImage["RelPath"].ToString().LastIndexOf(".") + 1);
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + romImage["Description"].ToString() + "." + extension + "\"");
Response.ContentType = "image/" + extension;
System.Drawing.Imaging.ImageFormat imgFormat = System.Drawing.Imaging.ImageFormat.Jpeg ;
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);