in reply to Re: Examples of Archive::Zip
in thread Examples of Archive::Zip
I uploaded foobar.txt in the same folder using an absolute path and at run time I get PK=8†0 foobar.txtadadasddsC™ PK=8†0C™ ¶foobar.txtPK8=. This proves two things though. It proves it can find the foobar.txt and is goofing around with it and also proves it can read it "adadasdds" is the entirety of the text file.
I get this text message to browser, it doesn't die or anything and no popup window exists. What should I do?
#!/usr/bin/perl use warnings; use CGI::Carp 'fatalsToBrowser'; $|++; use strict; use CGI qw/:standard/; use Archive::Zip; my $fileToUpload = 'foobar.txt'; 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 header( -type => 'application/zip', -attachment => "$fileToUpload.zip" ); binmode( STDOUT ); # once again, for win32 $zip->writeToFileHandle(\*STDOUT);
|
|---|