#!/usr/bin/perl -w
use strict;
use CGI;
use Archive::Zip;
##Initialize CGI
my $cgi = new CGI;
print $cgi->header();
##Ohnoes start over
unless( $cgi->param('step') ) {
starthtml();
print <Please enter the number of files you need to upload:
HTML
##FormStuff
print $cgi->start_form;
print $cgi->textfield('nfiles');
print $cgi->hidden('step','2');
print $cgi->submit;
print $cgi->end_form;
##Finish off Teh HTML
print <
HTML
}
if ( $cgi->param('step') == '2' ) {
##Clear the step num
$cgi->delete('step');
starthtml();
##Start Form and loop through to create number of upload fields we need
print $cgi->start_form;
for(my $i = 1; $i <= $cgi->param('nfiles');$i++) {
print $cgi->filefield(-name=>"file$i"),"
\n";
}
##Next step, also send number of files again
print $cgi->hidden('step','3');
print $cgi->hidden('nfiles',$cgi->param('nfiles'));
print $cgi->submit();
print $cgi->end_form();
} elsif ( $cgi->param('step') == '3' ) {
##Here is teh problem##
my @files;
for (my $i = 1; $i <= $cgi->param('nfiles'); $i++) {
my $filename = $cgi->param("file$i");
my $upload_filehandle = $cgi->upload("file$i"); ## Probably not the best way to do that but ohwell
###
### Archive::Zip Processing here
###
}
sub starthtml {
print <
Update Tool