my $base = shift || $upload_path;
my $found = 0;
my @dirs;
my @files = <$base/*>;
my @files = glob("$base/*");
foreach (@files) {
if (-d $_ and -w $_) {
my $lastdirname = basename($_);
my $file_path = $file->{filepath};
if( -f $file_path ) {
open FH, '<', $file_path or die "Can't open file: $!";
open my $fh, '<', $file_path or die "Can't open file: $!";
print $input->header(
-type => "application/octet-stream",
-attachment => $file->{filename}
);
while(<FH>) {
while(<$fh>) {
print $_;
}
} else {
-