Solved

Force download of file on remote server

Posted on 2008-10-29
2
1,690 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 500 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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