I've got Archive::Zip installed on my system and do not remembering installing it, so I am not sure if it is a core module. If so, something like this should suit you fine. This script is even tested ;)
#!c:/perl/bin/perl -w $|++; use strict; use CGI::Simple; use Archive::Zip; my $fileToUpload = 'foobar.txt'; my $CGI = CGI::Simple->new(); my $zip = Archive::Zip->new(); open( my $fh, '<', $fileToUpload ) or die "open failed: $!"; binmode( $fh ); # for win32 my $contents = do { local $/; <$fh> }; close( $fh ); $zip->addString($contents, $fileToUpload); print $CGI->header( -type => 'application/zip', -attachment => "$fileToUpload.zip" ); binmode( STDOUT ); # once again, for win32 $zip->writeToFileHandle(\*STDOUT);
In reply to Re: temporary file zipping
by Anonymous Monk
in thread temporary file zipping
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |