Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

download and redirect to another page

New Here ,
Jul 02, 2008 Jul 02, 2008
I used the following code to download a pdf file (download.cfm) but the current page becomes blank. I want it to change to another page (view.cfm) using self.location but without success

view.cfm
<cfdirectory
directory="/var/www/html/"
action="list"
filter="*.pdf"
name="fax">
<cfoutput query="fax">
<a href="download.cfm?filename=#fax.name#">#fax.name#</a><br>
</cfoutput>


download.cfm
<cfheader name="Content-Disposition" value="inline; filename=#url.filename#">
<cfcontent type="application/pdf" file="/var/www/html/#url.filename#">
<script>
self.location="view.cfm";
</script>

pls kindly advise.
578
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2008 Jul 02, 2008
have you tried <cflocation url="view.cfm"> ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 03, 2008 Jul 03, 2008
LATEST
You can't do what you're trying to do. <cfcontent file="..."> stops processing of the page.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_c_11.html#2850760
And the description next to the file attribute includes:
"When you use this attribute, any other output on the current CFML page is ignored; only the contents of the file are sent to the client."

Why not just have the download.cfm link open in a new window? target="_blank"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources