【发布时间】:2016-12-07 22:07:56
【问题描述】:
[HttpPost]
public JsonResult SavePhoto(string base64)
{
string file = "test.jpg";
string Imgpath = Path.Combine(Server.MapPath("~/Img/"), Path.GetFileName(file));
System.IO.File.WriteAllBytes(Imgpath, Convert.FromBase64String(base64));
return Json(new { status= true},JsonRequestBehavior.DenyGet);
}
我从 Postman 发出一个请求并将 Base64 字符串发送到调用 Action 它返回 "true" 并在本地保存图像,但没有将图像保存到服务器 "Img" 文件夹。如果我的代码没有问题,那么为什么 Image 没有保存到服务器 "Img" 文件夹
【问题讨论】:
-
你对那个 IIS 用户的文件夹有写权限吗?
-
权限怎么写...?
-
@Ganesh_Devlekar 不,它不起作用....实际上我想将图像存储到服务器文件夹“Img”中。该图像存储在我的本地计算机上,但未存储到服务器文件夹“Img”中。请帮我一个 100% 合适的答案
-
您是否遇到任何错误或异常? 100% 的问题只是权限
标签: c# asp.net-mvc