Hopefully your ISP can provide you with access to someplace outside of the web root, 
first of all.  Something that can be accessed by CF via a local path but not from a 
browser via ftp or http.

What you want to do is use cfcontent and push files to clients, rather than letting 
them be accessible via direct links.  Once you do that, you can enforce whatever 
permissions your CF app allows.

Your link on a page pointing to a document:
<a href="myfiledelivery.cfm?FID=#myFiles.uniqueIDorFileName#" target="_blank">

myfiledelivery.cfm contains:

...Security goes here...
...maybe a query here that uses url.FID to pull the filename, if you just pass a pk in 
the url...

<cfmodule 
        template="mytags/pushthefile.cfm
        FilePath=#request.myOffWebFilePath#
        FileName=#theFileName#
        MailTo=#theAdmin'sEmailAddress#>

and the file pusher tag itself:

<cfparam name="attributes.FilePath" default="" TYPE="string">
<cfparam name="attributes.FileName" default="" TYPE="string">
<cfif Len(attributes.FileName)>
   <cfset variables.FileToPush=attributes.FilePath&attributes.FileName>
      <cfif FileExists(variables.FileToPush)>           
         <cfheader 
            name="Content-Disposition" 
            value="attachment; filename="""#attributes.FileName#""">
         <cfcontent 
            type="application/unknown" 
            file=#variables.FileToPush#>
         <cfelse>
            <center><h1>Sorry, File Does Not Exist</h1></center>
            <cfabort>
      </cfif>
<cfelse>
   <center><h1>No File Selected</h1></center>
   <cfabort>
</cfif>

The above will always force a download/open dialog to come up, no matter what the file 
type.  I use this to push pdf's that display immediately in the browser:

<cfheader
   name="content-disposition" 
   value="inline; filename=#attributes.FileName#">
<cfcontent 
   type="application/pdf" 
   file=#variables.FileToPush#>

HtH,


--
-------------------------------------------
 Matt Robertson,     [EMAIL PROTECTED]
 MSB Designs, Inc. http://mysecretbase.com
-------------------------------------------

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to