?
Solved

Force download of file on remote server

Posted on 2008-10-29
2
Medium Priority
?
1,697 Views
Last Modified: 2013-11-19
Hi there,

We're trying to create a link that when a user clicks will force the file "Save As" dialog box to pop up, rather than have the file open in the user's browser.

The catch is that the link goes to a remote server that we do not run. I've seen solutions for setting headers, etc. if the file resides on the local server, but is there a way to accomplish this when linking to a file on another server?

Thanks!
0
Comment
Question by:velir
[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
2 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 2000 total points
ID: 22835461
Hi velir,

The remote server admins would have to work with you to send the headers to force the download.  Alternately, you can try to script a behavior that transfers the file to your server first, then sends it to user with the correct header to force a download but that would look very slow to the end user (two transfers to get one file).

0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22838137
the "save as" dialog box depends on the USER's system, how they have set up the file links, and which ones are to be viewed by which, or downloaded.  The only really safe file extension almost guaranteed to be downloaded is a .ZIP file extension.  Since the server is remote and you cannot change it, you are out of luck, unless to take the contents of that remote link, ZIP it up into a ZIP file, and put a link to it on YOUR server, and you'd probably need their permission to do this -- but that would solve the problem.
0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

800 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