//将虚拟路径转化为文件的路径然后最后转化为文件流
public ActionResult SaveImage(string path)
{ var url =System.Web.HttpContext.Current.Request.PhysicalApplicationPath + path;FileStream fs = new FileStream(url, FileMode.Open, FileAccess.Read); //将图片以文件流的形式进行保存
BinaryReader br = new BinaryReader(fs); byte[] imgBytesIn = br.ReadBytes((int)fs.Length); //将流读入到字节数组中 Encoding myEncoding = Encoding.GetEncoding("utf-8"); string stImageByte = Convert.ToBase64String(imgBytesIn);return Json(stImageByte);
}