[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);
}
我做从邮差的请求,并发送一个Base64字符串给调用操作它返回“真”和图像保存在本地,但没有图片已被保存到服务器“Img”文件夹。如果我的代码,那么为什么图像中没有保存到服务器“图”文件夹没有问题图像文件没有保存到服务器“图”文件夹
您是否对该IIS用户的该文件夹的服务器拥有写入权限? –
如何写权限...? –
看看这个答案http://stackoverflow.com/questions/26849554/createdirectory-at-server-in-a-shared-machine/26850094#26850094 –