|
|
Forcing a link to download to the HD instead of loading in-window
|
|
|
|
Junior Member
Join Date: Nov 1999
Status:
Offline
|
|
Does anyone know what you can do in the HTML or on the server-side (Apache) to make a certain link always download the file instead of trying to interpret/load it in the window.
In specific, I want a link that will force it to download .jpg's and .mov's.
0- end of document;
|
|
|
|
|
|
|
|
|
Administrator
Join Date: Jun 2000
Location: California
Status:
Offline
|
|
stuff / archive / encode the files. A .sit, .zip, .tar file will (usually) download when clicked. The browser seems to be in control of the download option, rather than the page code. I could be wrong.
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Nov 1999
Status:
Offline
|
|
Originally posted by reader50:
<STRONG>stuff / archive / encode the files. A .sit, .zip, .tar file will (usually) download when clicked. The browser seems to be in control of the download option, rather than the page code. I could be wrong.</STRONG>
That's not gunna do it. I need this to work for any .mov or .jpg I have, and there are a lot because it loads them from a database.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jun 2001
Status:
Offline
|
|
Originally posted by chasnhisimac:
<STRONG>Does anyone know what you can do in the HTML or on the server-side (Apache) to make a certain link always download the file instead of trying to interpret/load it in the window.
In specific, I want a link that will force it to download .jpg's and .mov's.
0- end of document;</STRONG>
You need to do this on the server side. If you are using PHP for example you might have a line like this
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=download.mov");
then code that reads the file and writes it out, probably fpassthru()
The 'filename=' part tells the browser what filename to use
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
I think you can use content-type OR content-disposition, but not both.
Also, you're gonna have fun in IE because regardless of what type of data you tell IE, it sniffs the information to see if it knows what it is - if it does then I'll try to open it up in a helper program if possible, if not then it'll ask the user to download it.
I'm pretty sure IE 4.0sp2 + do this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|