in reply to Forcing a Word Document to Download
Is there a cool Perl way to do this?
You could write a CGI script something like this:
I don't know how "cool" that is... You might want to name it "word.doc" so that the browser tries to save it with a useful name.#!/usr/bin/perl -w use strict; my $real_doc = 'path/to/actual/document.doc'; open WORD, '<', $real_doc or die "$real_doc: $!\n"; print "Content-type: application/octet-stream\n\n"; print while <WORD>;
More seriously, The Right Way To Do It™ (for some notion of "right") is to change the mime-type in your server configuration. Of course, what's actually done with the data is up to the browser anyway.
Why do you want to do this? If you want to provide separate links for "read it online" and "download it" you might want to consider just zipping the document up and providing a link to the zipped version for download.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Forcing a Word Document to Download
by sgifford (Prior) on Jul 11, 2003 at 02:02 UTC | |
by sauoq (Abbot) on Jul 11, 2003 at 02:05 UTC |