A generic error occurred in GDI+

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?YmFzdWxhc3o=?=

    A generic error occurred in GDI+

    I am trying to upload a picture to a specific folder. I have a code below;
    _______________ _______________ _______________ ______________
    System.Drawing. Image oImg =
    System.Drawing. Image.FromStrea m(TextBoxFileUp load.PostedFile .InputStream);//
    ..FromFile(file FullName);

    System.Drawing. Image oThumbNail;// = new Bitmap(rect.Wid th, rect.Height,
    oImg.PixelForma t);

    Graphics oGraphic;
    try
    {
    oThumbNail = new Bitmap(rect.Wid th, rect.Height, oImg.PixelForma t);
    oGraphic = Graphics.FromIm age(oThumbNail) ;
    }

    oGraphic.Compos itingQuality = CompositingQual ity.HighQuality ;
    oGraphic.Smooth ingMode = SmoothingMode.H ighQuality;
    oGraphic.Interp olationMode = InterpolationMo de.HighQualityB icubic;
    oGraphic.DrawIm age(oImg, rect);

    oThumbNail.Save (destFolder + "\\" + fileName,
    System.Drawing. Imaging.ImageFo rmat.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..
Working...