invalid parameter when doing FromStream

V

Vinki

Hello Everyone,

I have this code below, I keep getting invalid parameter on the line below:

System.Drawing.Image b =
System.Drawing.Image.FromStream(ms);

[WebMethod]
public bool PutImage(byte[] ImgIn, string clipBoardGUID)
{
try
{
System.IO.MemoryStream ms =
new System.IO.MemoryStream(ImgIn);
System.Drawing.Image b =
System.Drawing.Image.FromStream(ms); -----------> right here

string clipBoardDataDirectory = Server.MapPath(".") +
"\\attachments\\" + clipBoardGUID + ".jpg";
b.Save(clipBoardDataDirectory,
System.Drawing.Imaging.ImageFormat.Jpeg);
}

catch (Exception ex)
{
string c = ex.Message;
return false;

}

return true;
}



I am trying to save an image that has been pasted on richtextbox in vb.net
side. I converted the image to array of bytes.

I have been struggling with this, any help will be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top