Read.TimeOut:“ stream.Read.TimeOut”引发了类型异常 'System.InvalidOperationException' 和“获取错误”参数无效,这是什么问题,哪里有问题?
public ActionResult AddNewProduct(string thumb_values)
{
var ImageCode = thumb_values.Split(',');
var imagepart = ImageCode[1];
byte[] data = Encoding.UTF8.GetBytes(imagepart);
string b64 = Convert.ToBase64String(data);
Base64ToImage(b64);
return View();
}
public Image Base64ToImage(string base64String)
{
byte[] imageBytes = Convert.FromBase64String(base64String);
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
{
Image image = Image.FromStream(ms, true);//Getting Error here
parameter is not valid
return image;
}
}
我想将base64string转换为图像,以及如何将该图像保存到任何路径?