Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-10
8
Medium Priority
?
216 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month6 days, 18 hours left to enroll

783 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