NTS Forums

Please login or register.

Login with username, password and session length
 

News:

Welcome to the Newtek Technology Services Forum!


Author Topic: Open files above root  (Read 1651 times)

Offline Cliff

  • he
  • Full Member
  • ****
  • Posts: 703
  • Karma: +7/-2
    • PathLabTalk
Open files above root
« on: April 26, 2013, 12:38:53 PM »
OK, not sure if I have the terms correct, but on my server at work, I have direct access to the server.
The site sits on the H drive in H:\Inetpub\Wwwroot\mysite.org\.


I needed to protect some files so I put them in H:\scanned_files\.


Now, I don't get how I reference those in a link on a web page.
THis doesn't work (obvious for you maybe)
<a href="H:\scanned_files\#scan_category_pk#\#scan_doc_pk#.pdf"><img src="../includes/images/page_add.png" alt="View" width="16" height="16" border="0" /></a>


Any suggestions are greatly appreciated.

Offline morovan

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +54/-2
Re: Open files above root
« Reply #1 on: April 26, 2013, 01:44:19 PM »
You'll need to create a cfm file to serve the content that is outside the webroot:

serve.cfm

Code: [Select]
<cfif fileexists("h:\scanned_files\#url.filename#")>
<cfheader name="Content-disposition" value="attachment;filename=#url.filename#">
<cfcontent file="h:\scanned_files\#url.filename#" deletefile="false">
<cfelse>
File not found...
</cfif>

Then for your link you'll do something like this:
Code: [Select]
<a href="serve.cfm?#url.filename#"><img src="../includes/images/page_add.png" alt="View" width="16" height="16" border="0" /></a>
www.todayrealestate.com - Search the MLS for all properties for sale on Cape Cod, Massachusetts.

Offline Cliff

  • he
  • Full Member
  • ****
  • Posts: 703
  • Karma: +7/-2
    • PathLabTalk
Re: Open files above root
« Reply #2 on: April 27, 2013, 06:08:55 AM »
You're the best, thank you!  I'll try it on Monday when I get back to work.