I have a function which extracts a file into a byte array (data).
int contentLength = postedFile.ContentLength;
byte[] data = new byte[contentLength];
postedFile.InputStream.Read(data, 0, contentLength);
Later I use this byte array to construct an System.Drawing.Image object (where data is the byte array)
MemoryStream ms = new MemoryStream(data);
Image bitmap = Image.FromStream(ms);
I get the following exception "ArgumentException: Parameter is not valid."
The original posted file contained a 500k jpeg image...
Any ideas why this isnt working?
Note: I assure you I have a valid reason for converting to a byte array and then to a memorystream!!