foreach my $x ($q->param()) { # if a file upload: my $filename = $q->param($x); # loop read in the file: my $filedata = $buffer; $q->param('_filename', $filename); $q->param('_filedata', $filedata); } # a bunch of other stuff. # this is to :sigh: mail the file to someone remote $q->param('_filedata',encode_base64($q->param('_filedata'))); # stuff the data into an attachment by hand