A generic error occurred in GDI+

G

Guest

I am trying to upload a picture to a specific folder. I have a code below;
___________________________________________________________
System.Drawing.Image oImg =
System.Drawing.Image.FromStream(TextBoxFileUpload.PostedFile.InputStream);//
..FromFile(fileFullName);

System.Drawing.Image oThumbNail;// = new Bitmap(rect.Width, rect.Height,
oImg.PixelFormat);

Graphics oGraphic;
try
{
oThumbNail = new Bitmap(rect.Width, rect.Height, oImg.PixelFormat);
oGraphic = Graphics.FromImage(oThumbNail);
}

oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
oGraphic.DrawImage(oImg, rect);

oThumbNail.Save(destFolder + "\\" + fileName,
System.Drawing.Imaging.ImageFormat.Jpeg);

___________________________________________________________

And a have all permissions for the specified folder for IIS_WPG, ASP.NET
Machine Account, NETWORKSERVICE and even Everyone with full control.

But when I try to save a with the code on the last line, I get an exception
message "A generic error occurred in GDI+".

What else should I do?

Thanks a lot..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top