Coldfusion: download PDF

I have a URL that opens a PDF file:

<cfoutput>http://myUrl.cfm?params=#many#<cfoutput>

      

I want my users to download this PDF instead of opening it in a browser. I tried the following and it doesn't work:

<cfoutput>    
<cfcontent type="application/pdf" file="http://myUrl.cfm?params=#many#"/> 
<cfheader name="content-diposition" value="attachment; filename='http://myUrl.cfm?params=#many#'">
<cflocation url= "http://myUrl.cfm?params=#many#"/>
</cfoutput>

      

What am I doing wrong?

+2


a source to share


2 answers


<cfheader>

before <cfcontent>

you don't need to <cflocation>

.



http://tutorial217.easycfm.com/

+11


a source


<cfheader name="Content-Type" value="unknown">
<cfheader name="Content-Disposition" value="attachment; filename=FileName.jpg">
<cfcontent type="Application/Unknown" file="/http//downloads/FileName.jpg" deletefile="No">

      



+1


a source







All Articles