in reply to Re: Zipping Files
in thread Zipping Files

I am sorry, but had only missed one line, but here it is:
#!/perl/bin/perl -w use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use File::Find; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); # @chunks could be: file1.txt file2.txt file3.txt or more files or jus +t one my ($arch_path, $dir_archive_name, $outname, my @chunks); my $htdocs_out; open $htdocs_out, '>', "$arch_path/$dir_archive_name/$outname" +or die $!; foreach my $chunk_file(@chunks){ my $chunk_zip = Archive::Zip->new(); my $chunk_zipped; $chunk_zipped = $chunk_zip->addFile( $chunk_file ); print $htdocs_out $chunk_zipped; } close $htdocs_out or die $!;
Thanks again!

Replies are listed 'Best First'.
Re^3: Zipping Files
by samtregar (Abbot) on Jun 26, 2006 at 23:34 UTC
    I don't think addFile() is returning what you think it is. I think you need to use one of the write*() methods in Archive::Zip instead of trying to print out each chunk yourself.

    If that's not it, why don't you tell us what exactly the problem is. Do you get an error message? A corrupt file? Something else?

    -sam