protectable by CF.
Downloadable files need to be placed somewhere off the web root.
-----Original Message-----
From: Paul Vernon [mailto:[EMAIL PROTECTED]
Sent: November 16, 2003 10:41 AM
To: CF-Talk
Subject: RE: Ideas needed! Password protect a file download.
> The part I'm not sure about is protecting the file itself. I want the
file to be protected so no one can brows to it by http.
Jeff,
A bit of pseudo code for you.
<cfif loggedin IS true>
<cfcontent reset="yes">
<cfheader name="Content-Disposition"
value="attachment;filename=thefilenamethatyouwanttheusertosee">
<cfcontent file="Yourfilethatisntinyourwebrootincludingthefullpath"
type="putyourmimetypehere">
<cfelse>
<h3>Access denied!</h3>
</cfif>
Put this into a .cfm file and try it out.. Obviously, you need to set
the filenames and mime types correctly.. I use a piece of code like this
for zip files on our server. The getproductquery basically contains the
filename of the file I want to send to the user.
<cfheader name="Content-Disposition"
value="attachment;filename=#Trim(getproduct.Filename)#">
<cfcontent
file="#GetDirectoryFromPath(GetCurrentTemplatePath())##Trim(getproduct.F
ilename)#" type="application/x-zip-compressed">
Yours
Paul Vernon
http://www.web-architect.co.uk <http://www.web-architect.co.uk/>
t: +44 (0)844 779 9797
m: +44 (0)7887 952591
f: +44 (0)844 779 9797
e: mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
The information contained in this e-mail and any attachment is intended
only for the named addressee(s). If you are not the named addressee(s),
please notify the sender immediately and do not disclose, copy or
distribute the contents to any other person other than the intended
addressee(s).
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

