use Apache::Constants qw(:common); use Apache::Request; use Apache::File; sub handler { my $r = Apache::Request->new(shift); my $serverFile = $r->param('file'); # needs some errorhandling here if $serverFile is not # submitted, invalid paths, ... # get $contenttype somehow; I always save it in a # database when I upload the file my $fh = Apache::File->new($serverFile); binmode($fh); unless ($fh) { $r->log_error("Can't open '$serverFile': $!"); } # unless else { $r->send_http_header($contenttype); $r->send_fd($fh); } # else return OK; } # handler