Restricted access to non cf files using cf

2009-07-06 Thread Anastassios Hadjicrystallis
I have a question that its answer may be interesting and usefull for many CF developers. Here it is. I have a site, and I have a folder where access is restricted and I have a login page asking for user name and password. As usually I chech these access data in my database and I give or give

Re: Restricted access to non cf files using cf

2009-07-06 Thread Ryan Stille
Store them outside of the webroot and use cfcontent to serve them to the browse when necessary. -Ryan Anastassios Hadjicrystallis wrote: I have a question that its answer may be interesting and usefull for many CF developers. Here it is. I have a site, and I have a folder where access is

Re: Restricted access to non cf files using cf

2009-07-06 Thread Jason Fisher
Place your non-CF files into a non-web folder (say, C:\SecureFiles\MySite\ or whatever) and then serve those files through a CF script. For example, perhaps the file request link looks like this: href=index.cfm?event=file.downloadid=xyz Then the file.download event checks the session; if

Re: Restricted access to non cf files using cf

2009-07-06 Thread Claude Schneegans
Store them outside of the webroot and use cfcontent to serve them to the browse when necessary. Some people have no access to folders outside the webroot. In that case, one solution is to : 1. register all files in your database with their original name and type (pdf, doc, etc.) 2. store any

Re: Restricted access to non cf files using cf

2009-07-06 Thread Jason Fisher
Nice solution for those in hosted environments, Claude! Simple and effective! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive:

Re: Restricted access to non cf files using cf

2009-07-06 Thread Anastassios Hadjicrystallis
Well, all these solutions fit in case that we want to restrict access to pdf or doc etc files which after login we serve them as a page. What could be done when the files, we want to restrict access to, are PART of a web (cfm) page ? I mean, in the restricted folder after login I display cfm

Re: Restricted access to non cf files using cf

2009-07-06 Thread Claude Schneegans
any other idea without cfcontent ? Nope. Any solution to give access or not must be based on some CF code to abort the request if the user has no access, or send the document if he has. And the proper tag for CF to send the document is CFCONTENT.

Re: Restricted access to non cf files using cf

2009-07-06 Thread Ian Skinner
Anastassios Hadjicrystallis wrote: Am I wrong? If I am not any other idea without cfcontent ? cfcontent can server up any type of web content including image files. You would just put the name of the cfm template that contains the cfontent tag into the img href=... property. Then

Re: Restricted access to non cf files using cf

2009-07-06 Thread Anastassios Hadjicrystallis
cfcontent can server up any type of web content including image files. You would just put the name of the cfm template that contains the cfontent tag into the img href=... property. Then the cfcontent... tag would server up the image file from the secure location with the proper

Re: Restricted access to non cf files using cf

2009-07-06 Thread Ian Skinner
Your example was not quite the same as the Adobe example. They had reset=yes in their cfcontent tag. Try that with yours. It is especially important with binary data like an image file, to not have any extraneous white space that may be hanging around in the cfm file. The reset=yes

Re: Restricted access to non cf files using cf

2009-07-06 Thread Anastassios Hadjicrystallis
Your example was not quite the same as the Adobe example. They had reset=yes in their cfcontent tag. Try that with yours. It is especially important with binary data like an image file, to not have any extraneous white space that may be hanging around in the cfm file. The reset=yes

Re: Restricted access to non cf files using cf

2009-07-06 Thread Ian Skinner
Anastassios Hadjicrystallis wrote: Ian, I used reset=yes but no luck. When I run test.cfm and view source I see there the img tag img href=image.cfm. It looks like it does not run the image.cfm page at all. It treats it as a simple HTML tag. Why it should run image.cfm? What force it to

Re: Restricted access to non cf files using cf

2009-07-06 Thread Dave Watts
Any idea how can I restrict access to any kind of content (htm, cfm, pdf, jpg, doc xls etc) using coldfusion ? As many have mentioned, you can store them in a directory that isn't web-accessible, and serve them with CFCONTENT. Another alternative is to store them as mentioned above, but use

Re: Restricted access to non cf files using cf

2009-07-06 Thread Dave Watts
Placing the jpg files outside the webroot ok none not logged in can http them, but then I can't use them in img src=... either. I think cfcontent can't help in this case. Sure it can. CFCONTENT can be used to serve any sort of file you want. All an IMG tag does is tell the browser to make