[Whoops, just posted this reply to Users by mistake.]

"Syed Anwaruddin" <[EMAIL PROTECTED]> writes:

> Yes. On my HTML Page I have a Begin Download Button.Once I click this Files 
> get zipped and I get Save As (x-zzip-compressed Application) Dialog Box. In 
> the Selection field of the Dialog box I get my Perl Script as default. I 
> want my my zip file in Selection field.
> 
> Please help me if you know any thing about this.

Syed,

Which browser are you using? If it is MSIE 4.01, it likely won't work;
see my reference to the KB article below.

Here's an example of downloading a CSV file with `CGI.pm'. Works in
MSIE 5.0 (and hopefully 5.5) as well as Netscape 4.7x. Note, however,
the hourglass problem in MSIE 5.0 that I mention below; looks like it
may be a bug that has been fixed in later versions of the browser.

                                # # #

#!/usr/bin/perl -w

# Won't work with MSIE 4.01:
#   http://support.microsoft.com/support/kb/articles/q182/3/15.asp
#
# Hourglass problem with MSIE 5.00.2314.1003 (on WinNT 4, sp6a,
# but not on Win2000, 5.00.2920.0000); don't know whether the
# following is related:
#   http://support.microsoft.com/support/kb/articles/Q286/3/26.ASP

use strict;
use CGI qw(:cgi);

my $filename = "foobar.csv";

my $content = <<"*DATA*";
"1a","1b","1c"\cM
"2a","2b","2c"\cM
"3a","3b","3c"\cM
*DATA*

print
  header(
         -type => 'application/octet-stream',
         -content_disposition => qq(attachment; filename="$filename"),
         -content_length => length($content),
         -expires => 'now',
        );

binmode STDOUT;
print $content;

__END__

--David

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to