if ($event = $cgi->param('event')) { $description = $cgi->param('description'); $fh = $cgi->upload('file'); my $file4desc = $fh; $file4desc =~ s/\.\w+$/\.txt/; if (-e "$event/$file4desc") { print "There's already a file under that name. Please rename the file and try again."; } else { open FILE, ">$event/$fh"; while (<$fh>) { print FILE $_; } close FILE; open DESC, ">$event/$file4desc"; ($sec,$min,$hour,$date,$mon,$year,$wday,$ydat,$isdst) = localtime(); $year += 1900; $mon++; print DESC "$description added $mon/$date/$year by $username"; close DESC; print "Uploaded $fh"; } } else { my @events = ('event1,event2,event3'); print "
\n"; print "\n"; print "

Upload

\n"; print "Event:
\n"; print "

\n"; print "File:
\n"; print $cgi->filefield(-name => 'file'); print "

Description:
\n"; print "
\n"; print "\n"; print "

"; }