Solved

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

Posted on 2008-10-10
8
197 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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