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..
___________________________________________________________
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..