I'm trying to use Archive::Zip to compress some text files for clients to download, but they appear to be corrupted. I get an error message, and only the first file in the .zip is extracted (regardless of which file that is).
I can see all the files when I look at the compressed file contents.
I am using Centos 5.2 x86_64 with perl 5.8.8 and Archive::Zip 1.30. Here is the error message I get:warning [/home/student1/Desktop/compounds1310483480.zip]: 104 extra b +ytes at beginning or within zipfile (attempting to process anyway) file #1: bad zipfile offset (local header sig): 104 (attempting to re-compensate) bad CRC 50b35a73 (should be 00000000) file #2: bad zipfile offset (local header sig): 405 (attempting to re-compensate) file #2: bad zipfile offset (local header sig): 405 file #3: bad zipfile offset (local header sig): 1020 file #4: bad zipfile offset (local header sig): 1552
The errors I get when attempting to extract the files in Windows/OSX are 'corrupt/invalid'.
Here is the code I use to create the zip file:
foreach my $memberName (@MOL2_files) { if (-d $memberName ) { print $log "Adding $memberName\n"; warn (print $log "Error adding directory $memberName\n") if $zip->addTree( $memberName, $memberName) != AZ_OK; } else { print $log "Adding $memberName\n"; $zip->addFile( "/www/mol2/$memberName", "compounds".$time."/". +$memberName ) or warn (print $log "Error adding file $memberName\n"); } } open my $fh, ">>", $fullpath or die $!; print $log "Write Error.\n" if $zip->writeToFileNamed( $fh ) != AZ_OK;
Has anyone seen this problem before and know how to fix it? Or does anyone know of a different module I can use to perform the same function?
Thanks, Tom
In reply to Archive::Zip - zip files are corrupted or invalid by tomdbs98
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |