Skip to main content
Inspiring
March 20, 2008
Question

redirect after using cfheader/cfcontent

  • March 20, 2008
  • 1 reply
  • 1011 views
I have a file that a user is prompted to download using

<cfheader
name="content-disposition"
value="attachment; filename=ProPlannerRevenueTemplate.xls" />

<cfcontent
type="image/jpeg"
file="#ExpandPath( './download_templates/ProPlannerRevenueTemplate_#Left(Hash(session.client_id), 15)#.xls' )#"
deletefile="yes" />


Afterwards, I want to redirect the user to another page, but the <cflocation> tag I have after this doesn't seem to execute. Any ideas on how to restructure this so that it will work?
This topic has been closed for replies.

1 reply

Inspiring
March 20, 2008
I do not think you can do these two operations with the same request. A
<cflocation...> works by sending a client a HTTP status of 302 FOUND
(Moved Temporarily). If the client acted on this status it would move
to the specified URL and not download the file. OR it does not act on
this status and receives this response.

What you are attempting to do, is probably best done with some client
side code. That uses JavaScript to relocate the client once this
response is received.

Why this is not currently relocating and sending the file is probably
because of the default reset="yes" parameter of the <cfcontent...> tag
that discards any response generated before the tag.