我在抓路徑時,遇到了錯誤,想請問為什麼他會抓到專案底下的目錄,而不是我指定的c槽
public string UpLoadImage(string Account, string base64data)
{
string sRtn = "";
var type = "";
type= base64data.Substring(0, base64data.IndexOf(";"));
//base64data = base64data.Substring(base64data.IndexOf(","), base64data.Count());
base64data = base64data.Substring(base64data.IndexOf(",") + 1);
byte[] byteimage = Convert.FromBase64String(base64data);
var UpDirPath = "c:\vue_image";
if (!System.IO.Directory.Exists(UpDirPath))
{
System.IO.Directory.CreateDirectory(UpDirPath);
}
UpDirPath = Path.Combine(UpDirPath, @"\");
if (type.Contains("jpeg"))
{
System.IO.File.WriteAllBytes(UpDirPath + Account + "_image.jpg", byteimage);
sRtn = "上傳成功!";
}
else if (type.Contains("png"))
{
System.IO.File.WriteAllBytes(UpDirPath + Account + "_image.png", byteimage);
sRtn = "上傳成功!";
}
else
sRtn = "請上傳JPF檔orPNG檔,不支援其他檔案!";
return sRtn;
}
var UpDirPath = "c:\vue_image";
改成
string UpDirPath = @"c:\vue_image";
試看看