Hi Anish

The following example works and I have tested it.


use CGI;
$cgiObject=new CGI;

$filename="SRQ.zip";

print $cgiObject->header(-charset=>'',
                        -Expires=>'-1d' ,
                        -'Cache-Control'=>'private,
                        max-age=0',
                        -attachment=> $filename,
                        -type=>'application/octet-stream'

);


open ZIPFILE, "$filename" || die "Can't open $filename for reading";

binmode (ZIPFILE);

@file=<ZIPFILE>;

print @file;

close ZIPFILE;



Thanks
Prasanna

-----Original Message-----
From: Anish Kumar K. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 11, 2006 7:04 PM
To: Nagasamudram, Prasanna Kumar
Cc: beginners@perl.org
Subject: Re: Specify download file name

Hi Prasanna

Thanks for the reply. But that is not helping me in the situation

Thanks
Anish

Nagasamudram, Prasanna Kumar wrote:
> Hi Anish
>
> Can you try adding the following to your $cgiObject->header ?
>
> -attachment=>'$filename.zip',
>
> And changing
>
> -type=>'application/zip'   to -type=>'application/octet-stream'
>
>
> [PS : The above is not tested]
>
> Thanks
> Prasanna
>
> -----Original Message-----
> From: Anish Kumar K. [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 11, 2006 3:43 PM
> To: beginners@perl.org
> Subject: Specify download file name
>
> Hi
>
> This is somewhat easy question I feel but for some reason I am not 
> getting this
>
> The issue is I am using CGI to download a file, I am setting the
header 
> as this
> print 
>
$cgiObject->header(-type=>'application/zip',-charset=>'',-Expires=>'-1d'
> ,-'Cache-Control'=>'private, 
> max-age=0');
>
> the download works fine. But the issue is the file name it is coming
as 
> the filename...say when I download I am geting "downloadwav.pl".
> which is the file name of the perl file. Is there a way I can specify
a 
> file name, It is a zip file.
>
> I tried this
> $file_name="attachment.zip";
> print "Content-Disposition: attachment; filename = $file_name\n\n";
>
> Not working...any help
>
> Thanks
> Anish
>
>
>   


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to