SPUG: Re: mod_perl download handler help needed
Alan
alan at ufies.org
Thu Nov 14 14:54:52 CST 2002
On Thu, Nov 14, 2002 at 12:31:23PM -0800, Ryan Parr wrote:
> Wouldn't the line:
>
> $r->send_http_header($r->lookup_file($filepath)->content_type);
>
> Get back the text/html content type from your handler? Since this is using a
> full sub-request, I assume it would trigger your handler. You may be better
> off using a method to determine the mime-type other than Apache's subrequest
> function.
[snip]
> > my $filepath = $r->document_root . "/files/" .
> > $params{returnto};
> > $r->send_http_header($r->lookup_file($filepath)->content_type);
Nope, $filepath is the path to the file (a combination of the docroot,
/files/ and the "returnto" hidden parameter with the filename in it.
Because I'm using lookup_file it's returning the right content type.
Unfortunately the problem is on the save :(
I've hacked around this by symlinking /files to /downloads, and then on
completion of the form doing a redirect to /downloads/$params{returnto}.
Not the most secure, but adequate for now I guess. Maybe I'll throw
some sort of handler on /downloads and have it make sure that the
referrer for /downloads/$file is /files/$file or something.
alan
--
Alan <alan at ufies.org> - http://arcterex.net
---------------------------------------------------------------------
"The only thing that experience teaches us is that experience teaches
us nothing. -- Andre Maurois (Emile Herzog)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list