Apache2-OneTimeDownload

 view release on metacpan or  search on metacpan

OneTimeDownload.pm  view on Meta::CPAN


    # Return the file
    my $filesize= -s $file_path;
    my $subr = $r->lookup_file( $file_path  );
    return Apache2::Const::NOT_FOUND unless (defined($subr));

    $subr->headers_in->set( 'Range' => $r->headers_in->get('Range') ) if (defined($r->headers_in->get('Range')));

    $r->headers_out->set("Accept-Ranges" => "bytes");
    $r->headers_out->set("Content-Length" => $filesize);
    $r->headers_out->set("Content-Disposition" => "attachment; filename=".$file->{file});

    return $subr->run();

}


sub authorize {

  my ($db_name, $comments, $file, $expiry) = @_;



( run in 1.657 second using v1.01-cache-2.11-cpan-e1769b4cff6 )