Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Dermot
2008/8/19 Jonathan Rockway <[EMAIL PROTECTED]>: > * On Tue, Aug 19 2008, Dermot wrote: >$c->res->headers->content_type( $type ); >$c->res->headers->content_length( $stat->size ); >$c->res->headers->last_modified( $stat->mtime ); > .. >my $fh = IO::File->new( $full_path, 'r' );

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Wade . Stuart
Jonathan Rockway <[EMAIL PROTECTED]> wrote on 08/19/2008 01:20:53 PM: > * On Tue, Aug 19 2008, Dermot wrote: > > This method will work well for binary files. I have opted > > $c->response->header() method for now. > > You haven't described what that method is. > > There are two things you need to

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Jonathan Rockway
* On Tue, Aug 19 2008, Dermot wrote: > This method will work well for binary files. I have opted > $c->response->header() method for now. You haven't described what that method is. There are two things you need to do to send a file for download. 1) Set up the HTTP headers (Content-disposition) s

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Dermot
2008/8/19 Bogdan Lucaciu <[EMAIL PROTECTED]>: > On Tuesday 19 August 2008 16:41:40 Carl Franks wrote: >> You'll still need the body($fh) bit to send the data, too. > Or, if you use Catalyst::Plugin::Static::Simple, you can use: > > $c->serve_static_file($file_path); > > some code snippets from that

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Ash Berlin
On 19 Aug 2008, at 14:27, Dermot wrote: 2008/8/19 Carl Franks <[EMAIL PROTECTED]>: 2008/8/19 Dermot <[EMAIL PROTECTED]>: sub downloadFile { my ($name, $filepath) = @_; my $length = (stat($filepath))[7]; my $res = $c->response; $res->content_length($length); $res->headers->({ 'Content-Dispo

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Bogdan Lucaciu
On Tuesday 19 August 2008 16:41:40 Carl Franks wrote: > You'll still need the body($fh) bit to send the data, too. Or, if you use Catalyst::Plugin::Static::Simple, you can use: $c->serve_static_file($file_path); some code snippets from that method: $c->res->headers->content_type( $type );

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Carl Franks
2008/8/19 Dermot <[EMAIL PROTECTED]>: > 2008/8/19 Carl Franks <[EMAIL PROTECTED]>: >> 2008/8/19 Dermot <[EMAIL PROTECTED]>: >>> sub downloadFile { >>> >>> my ($name, $filepath) = @_; >>> >>> my $length = (stat($filepath))[7]; >>> my $res = $c->response; >>> $res->content_length($length); >>> >>

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Dermot
2008/8/19 Carl Franks <[EMAIL PROTECTED]>: > 2008/8/19 Dermot <[EMAIL PROTECTED]>: >> sub downloadFile { >> >> my ($name, $filepath) = @_; >> >> my $length = (stat($filepath))[7]; >> my $res = $c->response; >> $res->content_length($length); >> >> $res->headers->({ 'Content-Disposition' => >> "

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Carl Franks
2008/8/19 Dermot <[EMAIL PROTECTED]>: > Hi, > > I am looking for a method to send a file in response to a request. My > effort is below and all this does is print the file's path on the > page. I can't set the content-disposition or see find an obvious > method in C::Response or C::Request. > > Am

Re: [Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Oliver Gorwits
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Dermot, Dermot wrote: | I am looking for a method to send a file in response to a | request. Have you considered Catalyst::Plugin::Static::Simple ? ~ http://search.cpan.org/perldoc?Catalyst::Plugin::Static::Simple Or, use a suitably configured

[Catalyst] Catalyst::Response - send a file

2008-08-19 Thread Dermot
Hi, I am looking for a method to send a file in response to a request. My effort is below and all this does is print the file's path on the page. I can't set the content-disposition or see find an obvious method in C::Response or C::Request. Am I looking in the wrong place? Can someone point me i