Solved

How can i download files via a link which are not in a web dir ?

Posted on 2008-10-10
8
204 Views
Last Modified: 2013-12-24
I have a need for users to download some files like copy of their invoices which are not stored on a
Dir which is exposed via a webserver. So i would like to use something like a cffile to be able to access
these files which are on a network share. How can i use cffile to either allow the usere to get the pdf file
directly on his screen or ask him where he wants to save it

Thanks
0
Comment
Question by:AlexPonnath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 22693332
You offer to user a link that contains a target CFM page that does the cfcontent download.

The link looks like this:

<a href="download.cfm?filename=yourfile.pdf">yourfile.pdf</a>

Or if the file share path has to be provided:
<a href="download.cfm?filename=\\servername\sharename\foldername\yourfile.pdf">yourfile.pdf</a>


The download.cfm takes that URL.filename parameter and provides the <cfcontent>
Like this:

<cfcontent file="#URL.filename#" > 

and if all fileshare path is the same folder:

<cfcontent file="\\server\share\folder\#URL.filename#" > 




0
 
LVL 63

Expert Comment

by:Zvonko
ID: 22693353
But be aware that access rights problem is NOT solved that proposal.
The download.cfm has to check for user rights to access download.cfm
The file share has to be set to allow ColdFusion associted system user to access the share for at least read access.


0
 

Author Comment

by:AlexPonnath
ID: 22694280
Ok, but how can i prompt the user if he wants to save the file instead of just displaying it o the webpage ?

0
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
LVL 63

Expert Comment

by:Zvonko
ID: 22694904
Close first open questions.
Basicaly is this also answered but because you asked "... OR ask" you can wait for that second part until you closed the other answered questoions.
0
 

Author Comment

by:AlexPonnath
ID: 22694982
what are you talking ? i did not know how this is going to behave until i tried the code !
So for me the ansewr is incomplete since it does not produce the desired solution !
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 22696654
download.cfm:
<cfheader name="Content-Disposition" value="inline; filename=#URL.filename#">
<cfcontent file="D:/coldfusion8/wwwroot/ee/#URL.filename#" type="application/octet" >

Open in new window

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 22700594
Any progress here?
0
 

Author Closing Comment

by:AlexPonnath
ID: 31505209
n/A
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question