Like everyone has said... use cfcontent/cfheader to download the files. This
will also allow you to move the PDFs outside of your webroot since you no
longer need direct URLs to the files. Moving the files will keep people from
stumbling onto them and downloading them directly.
So on your download page you would do something like...
<cfif isLoggedIn()>
<cfif fileExists(pathToFile)>
<cfheader name='content-disposition'
value='attachment;filename="My File.pdf"' />
<cfcontent type="application/pdf" file="#FullPathToFile#" />
<cfelse>
404: File not Found
</cfif>
<cfelse>
Not Logged In
</cfif>
Notice the single quoted attributes of cfheader. This is so you can wrap the
file name in double quotes which will allow spaces in your file names.
yes, I know spaces can be replaced... but that's not always the desired
result ;-)
..:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:310197
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4