Closed Thread Icon

Preserved Topic: Forcing a download Pages that link to <a href="https://ozoneasylum.com/backlink?for=17986" title="Pages that link to Preserved Topic: Forcing a download" rel="nofollow" >Preserved Topic: Forcing a download\

 
Author Thread
kevincar
Paranoid (IV) Inmate

From: north hills, ca usa
Insane since: Apr 2001

posted posted 06-14-2001 00:29

Hmmm...
Can't seem to figure this out.

I want to set up a web page to "FORCE" a download of a
PDF file - rather than display it. I know from the server-side
I can set the HTTP headers with a

<"Content-disposition", "attachment">

statement, but in this case I just want the browser
to specify the disposition, not the server.

Anyone know how to do this? Sorry if it seems simple -
I looked around but couldn't seem to find anything.



[This message has been edited by kevincar (edited 06-14-2001).]

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-14-2001 21:14

This can be tricky because it is up to the browser to determine what it does with different file types.

I've had the same issues in IE with Mp3 files and ended up zipping the files. Or forcing people to Save Target As.

I'm not entirely sure there is a way but let me know if you find one.


Walking the Earth like Kane

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 06-15-2001 00:07

Yeah, this one has me stumped. The only thing that came to mind was to zip the files but that adds an extra step to the process.

Hmm....

kevincar
Paranoid (IV) Inmate

From: north hills, ca usa
Insane since: Apr 2001

posted posted 06-15-2001 00:51

Thanks for the brain cells, guys, but it really can't be solved without
server-side programming (I think) - i tried an SSI solution:

code:
<html>
<head>
<title>Download&nbsp; Compliance Page</title>
<meta http-equiv="Content-Type" content="application/octet-stream">
<META HTTP-EQUIV="Content-disposition" CONTENT="attachment; url=manual.pdf">
<!--#include virtual="/test/" file="manual.pdf" -->
</head>
<body>
</body>
</html>



but it didn't work - then I tried redirecting, and that didn't work either...
hmmm is right.

What DOES work is opening the pdf file as a byte-stream with the MIME
header set to "Content-disposition: attachment".
If I could just figure out how to "insert" the byte stream after the HTTP
headers, it'l probably work.




linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-15-2001 05:07

send a mime type header from the server (i.e. not a META tag)
Content-type: application/octet-stream

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-15-2001 18:58

linear and/or Kevin

I know how to embed different headers into pages using meta tags, PHP Perl etc.

But how do you send different headers for a file you don't really have access to? I assume thats on the Server Side but I'm not sure how.


Walking the Earth like Kane

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-15-2001 19:28

in .htaccess (if your server admin permits overrides):

AddType application/octet-stream .pdf
AddType application/metaglorch .glo

http://httpd.apache.org/docs/mod/mod_mime.html#addtype

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 06-15-2001 19:58

Oh, see I was going to say that to change the MIME-TYPE would require changing it for all pdf files on the server but if you can overide it for certain directories, that is definitely the way to go. Cool!

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-15-2001 20:24

yet another reason that Apache is the best web server available.

Hew
Neurotic (0) Inmate
Newly admitted
posted posted 06-28-2001 01:19

Myself, I hate when stuff automatically downloads, unless it tells you what exactly it is etc.. like off download.com or whereever.

One way would be to make the file just popup in a popup window with open('','filename','');
or if you have a frame at the bottom or left with the width or height set to 1 or 0 but Im not sure if you can set it to 0. to parent.hiddenframe.location.href="link URL";

there are a good few ways , you can get applets to do it to.

icklepix

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 06-28-2001 03:40

Now the ultimate method would allow an individual to click on a "view" link to open the pdf in the browser plugin, or click on a "download" link to just download the file.....


Hmmmmm.....

So the question would be, would the .htaccess method control the .pdf files in the folder, or links to pdf files from an htm file in that folder?

[This message has been edited by Pugzly (edited 06-28-2001).]

« BackwardsOnwards »

Show Forum Drop Down Menu