Solved

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

Posted on 2008-10-10
8
209 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
Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

 
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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 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