http://qs321.pair.com?node_id=144063

filmo has asked for the wisdom of the Perl Monks concerning the following question:

Okay, so I've got a link in the page like this:
<a href="perl.cgi?random_id=23ljasdf09">
Which of course links to the correct file and pulls up the correct directory information from the database. perl.cgi then creates a URL string like this
$URL = "/base_directory/client/job/final.doc";
Where the 'final.doc' is the document refreneced by the 'random_id' in the original HREF link. (There are other checks in place, not shown here.)

Next, I want to 'push' that document to the user and have tried variations of:

print "Location: www.mysite.com/$URL";
And I end up with various results depending on the browsers. (some, on Windoz either open the file in Word or save it to disk; on Mac, it saves the file under the name "perl.cgi" instead of "final.doc" ??) What I'd really like is for the client to be able to click on the link and have the finished MS Word document saved to their disk (assuming they consent.) What's the best approach to this. I'm sure I must be doing something rather simple wrong. Thanks.

Originally posted as a Categorized Question.