use Apache::SubRequest; my $subr = $r->lookup_file($file); return 404 unless -f $file and $subr->status == 200; $r->content_type($subr->content_type); $r->send_http_header; return 200 if $r->header_only; $subr->run; $m->abort; #### $r->content_type('application/octet-stream'); $r->header_out('Content-disposition' => ("attachment; filename=$filename_base")); open($fh,"<".$filename_full) or $m->redirect('file_open_failed.html?name='.$filename_full); while(<$fh>) { $m->print($_); } close $fh; return;