Re: Download problem

2002-12-06 Thread zentara
On 06 Dec 2002 08:22:19 +0200, [EMAIL PROTECTED] (Stelian Iancu)
wrote:

Hello!

I try to download a file from a CGI script. Here is the code:

$self-header_props(-type='application/x-octet-stream',
-attachment=$file);
   
   open(FILE, $file);
   binmode(FILE);
   $/ = undef;
   my($data) = FILE;
   close(FILE);
   binmode(STDOUT);
   print $data;

I am using CGI::App, but the problem is not there. Anyway, the file is
written directly in the browser, I don't get a Save to disk dialog.

I'm guessing that the CGI::App module isn't doing the headers right.
Try this.

##3
#!/usr/bin/perl

$file = 'test.tgz';

printEOH; 
Content-type: application/octet-stream 
Content-Disposition: attachment\; filename=$file 

EOH

binmode STDOUT;
open (FH, $file) or die Can't open $file: $!;
binmode FH;
while(FH){print}
close (FH);

exit 0;




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Download problem

2002-12-06 Thread zentara
On Fri, 06 Dec 2002 08:22:19 +0200, Stelian Iancu wrote:

 I try to download a file from a CGI script. Here is the code:
 
 $self-header_props(-type='application/x-octet-stream',
 -attachment=$file);
   
   open(FILE, $file);
   binmode(FILE);
   $/ = undef;
   my($data) = FILE;
   close(FILE);
   binmode(STDOUT);
   print $data;
 
 I am using CGI::App, but the problem is not there. Anyway, the file is
 written directly in the browser, I don't get a Save to disk dialog.

I'm guessing something is wrong in the way you setup the header.

Here is a method that works for me.
#
#!/usr/bin/perl
$file = 'test.tgz';

printEOH;
Content-type: application/octet-stream
Content-Disposition: attachment\; filename=$file

EOH

binmode STDOUT;
open (FH, $file) or die Can't open $file: $!;
binmode FH;
while(FH){print}
close (FH);

exit 0;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Download problem

2002-12-05 Thread Stelian Iancu
Hello!

I try to download a file from a CGI script. Here is the code:

$self-header_props(-type='application/x-octet-stream',
-attachment=$file);

open(FILE, $file);
binmode(FILE);
$/ = undef;
my($data) = FILE;
close(FILE);
binmode(STDOUT);
print $data;

I am using CGI::App, but the problem is not there. Anyway, the file is
written directly in the browser, I don't get a Save to disk dialog.
The arguments of the header_props() function are exactly the same as for
the header() of CGI.pm. So how do I solve this problem? Do I miss
something here? 

Thank you!

-- 
Regards,
Stelian I.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]