#! /usr/bin/perl -wT # PSUEDO CODE # 1. Plain HTML page with check-boxed thumbnail images # 2. On submit() hi-res copies of the selected images are # added to a .zip file # 3. A new page is displayed listing the content and size # of the file with a link to the newly created file # 4. Once the file is downloaded it will be erased from the # server. (better to prompt the user to erase?) use strict; use CGI; use Archive:Zip; # Archive:Zip POD is at # http://theoryx5.uwinnipeg.ca/CPAN/data/Archive-Zip/Archive/Zip.html # Make a new CGI object my $q = CGI->new(); # Create an array of the file names (drawn from the name # tag in the HTML) to be added to the zip file my @selectedFiles = $q->param; # How to name the .zip file without risk of duplication? my $fileName= ####; my $zip=Archive:Zip->new($fileName); # Add the files to the zip file foreach my $key(@selectedFiles) $zip->addfile ($key); # Draw a new HTML page listing the .zip file contents plus # a link to download the file print $q->header( "text/html" ), $q->start_html(-title => "Directory of $fileName.zip", -bgcolor => "#ffffff" ), $q->h1( "Contained in $zipFileName" ), $q->start_ul; # for each member-file in the .zip file, print the file # as a list item foreach $key($zip->members()) print $q->li("$key"); print $q->end_ul, $q->p( "File Size: stat($fileName.zip)[7]" ), $q->a( "Download $fileName.zip", $fileName+".zip" ), $q->end_html;