【发布时间】:2012-12-17 20:08:39
【问题描述】:
我可以请求一个文件并将其返回。 我不知道如何显示打开/保存对话框。
查看:
function saveDocument() {
$.ajax({
url: '/Operacao/saveDocument',
type: 'POST',
DataType: "html",
success: function (data) {
//I get the file content here
}
});
}
控制器:
public void saveDocument() {
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition", "attachment; filename=SailBig.jpg");
Response.TransmitFile(Server.MapPath("~/MyPDFs/Pdf1.pdf"));
Response.End();
}
【问题讨论】:
标签: c# javascript asp.net asp.net-mvc asp.net-mvc-4