我可以请求一个文件并返回它。我不知道如何显示打开/保存对话框。
看法:
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();
}