Hi,
I read image data from a database and cache them locally to file via a
filestream.
One of my users commented that his application isnt showing images. On
checking his file cache I found that most of the files were only 1 byte in
length. I deleted all the files, re-ran the application and again the files
were truncated after 1 byte.
I protect my code with try/catch and log all exceptions to the windows event
log and to a log file. There were no exceptions listed.
We're on a domain.
The code works fine on other pcs. I can't work out why only one byte, or why
there's no error
// read in the record with binary reader
tableImages datarecord = new tableImages(reader);
// write the image to file
FileStream fs = new FileStream(ImageLocation, FileMode.Create,
FileAccess.Write, FileShare.None);
try
{
// Assign the image bytes to variable
byte[] data = datarecord.FileData;
fs.Write(data, 0, data.Length);
fs.Flush();
}
finally
{
fs.Close();
}// finally