[prev in list] [next in list] [prev in thread] [next in thread]
List: cgiapp
Subject: Re: [cgiapp] Download a file
From: Stelian Iancu <stelian.iancu () gmx ! net>
Date: 2002-12-05 10:54:47
[Download RAW message or body]
On Thu, 2002-12-05 at 12:00, Stelian Iancu wrote:
> Hello!
>
> I have this CGI::App and I want to give the user the possibility to
> download a file. For this, I show him a link which will execute one of
> my run-mode's. The file is outside htdoc. So I quite don't know how to
> accomplish that. It is possible in the run-mode to set the header as
> octet/stream and set the attachment to my file (like $file =
> /test/file.zip)? And after that, what do I do?
>
Here is the sub I am using:
sub download_method {
my $self = shift;
my $q = $self->query;
my $file = $q->param('path');
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat $file;
$self->header_props(-type=>'octet/stream', -attachment=>$file,
-length=>$size);
}
The save dialog appears, I save the file, but the resulting file is
always of size 3, no matter what file I download. Do I need to do
something else here?
--
Regards,
Stelian I.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic