I am receiving an image from the user and want to save it. Initially I do
Stream file = Request.Files[0].InputStream;
Then perform the save where file
from the previous step is passed in
using(var image = Image.FromStream(file)) {
// Set the codec parameters with another method. No Stream involved
image.Save(filename, codecInfo, codeParam); // Throws GDI+ exception
}
Exception type is : System.Runtime.InteropServices.ExternalException
Exception Message : A generic error occurred in GDI+
StackTrace:
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
Have referred other questions where new stream had to be created and kept open but in my case, I already have a input stream. How do I solve this problem?