Access files outside of web rootColdfusion script to call files outside of web root?
Page 1 of 1
8 Replies - 4564 Views - Last Post: 27 April 2009 - 09:01 AM
#1
Access files outside of web root
Posted 17 April 2009 - 09:34 AM
Is there a coldfusion script that can do this? I still want to get to them, but considering where they are now residing I do not know how to do that. If anyone can point me in the right direction, that would be wonderful! Not looking for any code at this point, just some direction. Thank you!
Replies To: Access files outside of web root
#2
Re: Access files outside of web root
Posted 17 April 2009 - 10:28 AM
#3
Re: Access files outside of web root
Posted 20 April 2009 - 08:38 AM
sansclue, on 17 Apr, 2009 - 09:28 AM, said:
Sansclue,
Thanks for the info. I have researched and implemented cfcontent. I have placed all sensitive documents above the web root and then created an actionpage to target them in their new location.
I'm using fusebox to create this app. Not sure if you are familiar with it. Actions are basically targeted using the url
<a href="https://xxx.xx.xxx.xxx/index.cfm?fuseaction=catControl.getFile" target="_blank">
getFile then has a fuseaction that points to a coldfusion action page (a fuse) that does the work. It's an interesting way to create an app.
I'm trying to pass variables in the query string, but it does not seem to like it. Here's what I am doing...
< a href="https://xxx.xx.xxx.xxx/index.cfm?fuseaction=catControl.getFile & data=#filePath#" target="_blank">
On the other end, the actionpage when processed give me an error that filePath is undefined. I ran a cfdump on the page that has the above link and the filePath returns a positive path to the file.
Am I appending the url properly to pass the variable? I've tried several combinations but I cannot seem to get it right. Thanks for any help you may be able to provide.
Cheers!
#4
Re: Access files outside of web root
Posted 20 April 2009 - 09:47 AM
Quote
Am I appending the url properly to pass the variable? I've tried several combinations but I cannot seem to get it right. Thanks for any help you may be able to provide.
OK, on the action page when I reference the passed variable I am successfully using #URL.data# instead of just #data# and it seems to work fine. In other situations I have used the latter and it has worked fine. Perhaps this has something to do with the fact that I am using Fusebox to build this app.
Cheers!!
#5
Re: Access files outside of web root
Posted 20 April 2009 - 03:49 PM
midasxl, on 20 Apr, 2009 - 08:47 AM, said:
No, it just has the wrong parameter name. The syntax is:
paramterName=parameterValue
So if want it to be called "filePath", use that name instead of "data".
... &filePath=#filePath#"...>
This post has been edited by sansclue: 20 April 2009 - 03:50 PM
#6
Re: Access files outside of web root
Posted 21 April 2009 - 10:48 AM
#7
Re: Access files outside of web root
Posted 22 April 2009 - 06:17 AM
#8
Re: Access files outside of web root
Posted 22 April 2009 - 06:57 AM
#9
Re: Access files outside of web root
Posted 27 April 2009 - 09:01 AM
Here's a URL example
<a href="index.cfm?fuseaction=catModel.getFile & file='share/local/name_of_file.txt'"
Then fusebox would map to the appropriate action page which is the following...
<!---This will extract the right 3 characters from the variable #URL.file#, thus getting the file extension---> <cfset type = Right(#URL.file#,3)> <cfswitch expression = "#type#"> <cfcase value="txt"> <cfcontent type="text/plain" file="#request.fileArea##URL.file#" deletefile="no"> </cfcase> <cfcase value="doc"> <cfcontent type="application/msword" file="#request.fileArea##URL.file#" deletefile="no"> </cfcase> etc, etc. for more mime types </cfswitch>
This works great!
Cheers!
This post has been edited by midasxl: 27 April 2009 - 09:05 AM
|
|

New Topic/Question
Reply




MultiQuote





|