A generic error occurred in GDI+.

May 7 2010 4:55 AM

Hi,
i actually extracting images from the oracle database and storing them on the file system using a .Net 2.0 console application when read the blob data and stores the bytes in memory before calling the Image.Save method to save the bytes to the file system, please refer to the piece of code below.
It works fine when i save the image on my Windows XP pc or on a windows server 2003 pc but when i save the image on a shared directory on Unix i get the error 'A generic error occured at GDI+. Have check the permission and disk space of the shared directory on the Unix server, its fine. if i saved another image there it did save only for some image that it does not save to the Unix server.
private
static void writetodisk(string fullpath, byte[] byteImage)
{
StreamReader sr = new StreamReader(new MemoryStream(byteImage));
FileInfo file = new FileInfo(fullpath);

try
{
error =
"";
if (byteImage != null)
{
if (!File.Exists(fullpath))
{

System.Drawing.
Image img = System.Drawing.Bitmap.FromStream(sr.BaseStream);
img.Save(fullpath, System.Drawing.Imaging.
ImageFormat.Jpeg);
img.Dispose();
}
sr.Dispose();
sr.Close();
}
}
catch (Exception ex)
{
error = ex.Message;

sr.Dispose();
sr.Close();
}
}

Can someone please help me urgently? is there a restriction on Unix which does not allow some byte to be saved on the server using the method Image.Save? through ftp the file got saved on the server

Answers (1)