use File::Basename; my $db = $cgi->url_param('db'); my $datei = $cgi->url_param('datei'); download("/fester_pfad/".$db."/".$datei); sub download { my $file = shift; my $fn = fileparse($file); print $cgi->header(-type=>'application/octet-stream',-attachment=>$fn); }