Thank you, Kenneth and Christopher.

I still couldn't get it to work, nothing happens when I click the Download
button. Here is my sub.

# the Download button's name is "Action"

sub do_work {
   if (param("Action") eq "Download") {
      print header(-type=>"application/octet-stream", \
                   -attachment=>"hello.txt");
   }
}

# it didn't work either when the absolute path for 'hello.txt' is provided
# absolute path: '/home/httpd/project3/hello.txt'

Sorry to bother you guys with a primitive question like this.

(The rest of the script works fine.)

Bob

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Kenneth A Graves
Sent: Wednesday, January 02, 2008 1:03 PM
To: Christopher Schmidt
Cc: [email protected]
Subject: Re: [Boston.pm] allow user to download a file from web server

On Wed, 2008-01-02 at 12:57 -0500, Christopher Schmidt wrote:
> I don't think this is the best solution. Instead, one should probably
> set the "Content-Disposition: attachment;
> filename=preferred_filename.pdf" . This will tell the browser "Download
> ths file to the filename specified" -- which  the browser will then
> present to the user with that filename as the default, and ask them
> where to save it, at least in lynx, Firefox, IE6/7, Safari, and Opera. 

On the one hand, gives the browser a suggested filename.

On the other hand, gives the browser a file extension, therefore letting
it cheat and go looking for a plugin/helper-app.

On balance, it probably is the best way to go with a modern mix of
browsers.  (IE5 I think was the one that always wanted to cheat.)

--kag

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.


 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to