无法从Base64字符串保存解码图像

时间:2014-03-27 05:59:50

标签: c# image base64

我正在保存从Base64字符串解码的图像,moethod成功地将Base64字符串转换为Image而没有任何异常,但在保存时,它会产生异常。

以下是代码

string serverpath = Server.MapPath("~/myImage");
imgFromString.Save(serverpath, System.Drawing.Imaging.ImageFormat.Jpeg);

Save() 方法提供此异常

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at RgInfo_Service.Service1.PutFile(String NameList, String EmailList, String PictureList, String DateList)in C:\Documents and Settings\awaqar\my documents\visual studio 2010\Projects\RgInfo_Service\RgInfo_Service\Service1.asmx.cs:line 55

0 个答案:

没有答案