Solved

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

Posted on 2008-10-10
8
192 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
Comment Utility
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
Comment Utility
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
Comment Utility
Ok, but how can i prompt the user if he wants to save the file instead of just displaying it o the webpage ?

0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:AlexPonnath
Comment Utility
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
Comment Utility
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
Comment Utility
Any progress here?
0
 

Author Closing Comment

by:AlexPonnath
Comment Utility
n/A
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now