0
我正在使用kendo-ui圖表導出爲pdf函數。我正在使用MVC控制器將其返回給客戶端,這工作正常。我也想將PDF保存到一個文件夾中。我可以同時做兩個嗎?如何將pdf保存到根目錄下的文件夾並將其返回給客戶端
[HttpPost]
public ActionResult Save(string contentType, string base64)
{
var fileContents = Convert.FromBase64String(base64);
var dt = DateTime.Now.ToString("d").Replace('/', '-').Replace(':', '-');
var fileName = string.Format("{0}--{1}.pdf", "SubjectProperty", dt);
string path = Path.Combine(Server.MapPath("~/Pdfs/"), Path.GetFileName(fileName));
return File(fileContents, contentType, fileName);
}