Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I don't want to keep a zip file of the files, I'd rather have it temporary and forgotten at the time it loads. I know I can unlink the zip file afterwards, but it looks like it might have what I'm looking for. This is hard for me to understand, will this create a temporary zip file that will disappear when the script ends?my $zip = Archive::Zip->new('somefile.zip');
Basically all I want to do is when they go to my script, it makes a zip file for a given $filename and pushes it as a download box so they can download it. So not only do I need to create a zip file and remove it (or not ever store it) but at the same time push it to the user to download.Archive::Zip::tempName( [$tmpdir] ) Create a unique name for a temp file, in the given directory or in the + first one of: /tmp $ENV{TMPDIR} $ENV{TEMP} . Archive::Zip::tempFile( [$tmpdir] ) Create a uniquely named temp file. It will be returned open for read/w +rite. If $tmpdir is given, it is used as the name of a directory to c +reate the file in. If not given, creates the file in the first direct +ory found in this list: /tmp $ENV{TMPDIR} $ENV{TEMP}
Can someone show me an example of how I would do any part of this? Compression isn't needed, just the fact it's a zip file will work. This is what I've got so far.
my $member = "/home/name/www/images/sunset.png"; my $zip = Archive::Zip->new('newfile.zip'); $zip->addMember( $member );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Examples of Archive::Zip
by BUU (Prior) on Apr 06, 2004 at 08:20 UTC | |
by Anonymous Monk on Apr 06, 2004 at 08:57 UTC | |
|
Re: Examples of Archive::Zip
by Anonymous Monk on Apr 06, 2004 at 08:16 UTC | |
by Anonymous Monk on Apr 06, 2004 at 14:07 UTC |