0

I have several buttons on a Download page that I want to link to different movies stored on the server so that once the user clicks the download button the movie will download to their computer. How do I do this? I thought it was simply a case of putting the directory path to the relevant file into the link for the button?

Here's the page: http://www.infomaticfilms.com/jack/infomatics/download.htm

Any help would be appreciated.

Jack

1 Answers1

0

I assume that you want the user to be presented with a Save As dialog instead of just opening the file in the browser?

There are really two components that make this happen:

  1. The user's browser is configured to download that type instead of open it directly. You have no control over this, it's up to the user's own configuration.
  2. Your server suggests to the browser that it should download that type instead of open it directly. This is done via a header value in your server's response.

The header you're looking for is called Content Disposition. How you use it is up to your server-side capabilities. But basically you want to set it to something like:

Content-Disposition: attachment; filename="filename.mpg"

This response header tells the browser that what you're sending it is a file and should be locally saved as one. (Remember that HTTP by itself has no notion of "files", only requests and responses with headers and data.)

Community
  • 1
  • 1
David
  • 208,112
  • 36
  • 198
  • 279