Thank you for YOUR reply! I tried using this and it kept erroring out. I ended up having to use CGI qw/:standard/ instead of Simple, but those little changes shouldn't be causing the problem.
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);
|