I've figured out my problem. Sorry for cluttering the mailing list. - Bob

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Xiong, Bob
Sent: Thursday, January 03, 2008 4:05 PM
To: Bogart Salzberg
Cc: [email protected]
Subject: Re: [Boston.pm] allow user to download a file from web server

Thank you, Bogart.

Now I have a different question to beg help from you guys. I want to print a
clean 'Thank you' page after a user hit the 'Submit' button. But I don't know
how to get rid of the other stuff (resulting from the form generated earlier)
that was already on the screen. Here is the code snippet that failed me.

if (param("Action") eq "Submit") {
   Print_thank_you();
}

sub print_thank_you {
   Print header;
   Print start_html("Thank You");
   Print end_html;
}

Thanks for your time and help,

Bob Xiong

-----Original Message-----
From: Bogart Salzberg [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 02, 2008 4:10 PM
To: Xiong, Bob
Cc: [email protected]
Subject: Re: [Boston.pm] allow user to download a file from web server


On Jan 2, 2008, at 12:00 PM, Xiong, Bob wrote:

> I'm struggling with CGI::Pretty to implement a button to let users  
> download
> files from a web server.

Like John said, a button can be scripted to request a URL when clicked.

<input type="button" value="Click Me" onclick="location.href =  
'http://whatever'">

If you need to dynamically locate or process the file on the server  
side you can do something like this:

(It's PHP code. Sorry. The HTTP part is the good stuff.)

     header("Pragma: public"); // required
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0, pre- 
check=0");
     header("Cache-Control: private",false); // required for certain  
browsers
     header("Content-Transfer-Encoding: binary");
     header("Content-Type: " . $mimetype);
     header("Content-Length: " . $filesize);
     header("Content-Disposition: attachment; filename=\"" . $name .  
"\";" );

... followed by printing "\n\n" and the contents of the file.

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
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to