I'm getting the "A generic error occurred in GDI+" error message while using the following code:
using (System.Drawing.Image originalImage = System.Drawing.Image.FromStream(upload.UploadedFiles.InputStream))
//Create empty bitmap image of original size
Bitmap tempBmp = new Bitmap(originalImage.Width, originalImage.Height);
Graphics g = Graphics.FromImage(tempBmp);
//draw the original image on tempBmp
g.DrawImage(originalImage, 0, 0, originalImage.Width, originalImage.Height);
//dispose originalImage and Graphics so the file is now free
Response.ContentType = "image/jpeg";
//Save the image file to original location
tempBmp.Save(Server.MapPath("~Products/General/Imgs/Menus/" + parentSysName + "/" + productID.ToString() + "_" + upload.UploadedFiles.FileName), System.Drawing.Imaging.ImageFormat.Jpeg);
Can you please help me how to solve this problem?
By the way, I looked on the internet, but I didn't found anything.