【发布时间】:2012-10-12 12:05:36
【问题描述】:
我有一个test.cfm,我在其中动态构建了一个 pdf 文件并使用<cfheader> 和<cfcontent> 将其输出到浏览器,但我仍然希望页面加载并显示“test html”:
<CFFILE action="readbinary" file="#expandpath("./test.cfm")#" variable="testcontent" />
<CFHEADER name="Content-Disposition" value="attachment; filename=""test.txt""; charset=utf-8">
<CFCONTENT type="text/plain" reset="yes" variable="#testcontent#">
<CFCONTENT type="text/html" reset="yes" /><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testdoc</title>
</head>
<body>test html</body>
</html>
(输出文件本身只是示例)
有没有办法做到这一点?
【问题讨论】:
-
加载页面,然后有一个 HTML 元重定向到下载?
-
这是个好主意!谢谢@PeterBoughton
标签: coldfusion http-headers mime-types attachment