On Thu, 6 Jun 2002 10:22:44 +0200, Martijn van den Burg 
<[EMAIL PROTECTED]> spoke gently:
> Hi list,
> 
> I want to present the user of my application with a 'download' pop-up box 
> when he clicks on a certain link. The download box must have a default name 
> already filled in. The (ASCII) data is generated on the fly.
> 
> This works already if I set 
> $self->header_props(-type=>'application/octet-stream') but (1) I'm not really 
> downloading an application (just a text file) and (2) the default name is the 
> name of my application, what I dislike.
> 
> According to RFC 1806 (http://www.pasteur.fr/cgi-bin/mfs/01/18xx/1806) I 
> should use the '-Content-Disposition' http header field.
> 
> So I created the following concoction:
> 
> 
>$self->header_props(-type=>'text/plain',-Content-Disposition=>'attachment;filename=dbase.txt');
>       
> 
> However, this prints the text in the browser window instead, of bringing up a 
> pop-up download box.
> 
> So the Q. is: Can header_props accept more than one argument? And if so, does 
> it accept 'Content-Disposition'?
> 
> By the way: this is not a browser quirk: behaviour is consistent in 
> Konqueror, Nitscope, Mozilla and Internet Exploder.

Yes, for some reason the key "-Content-Disposition" is not being saved. I
guess it's the hyphen. From a debug session:
.....
  DB<4> $app->header_props(-type=>'text/plain',-Content-Disposition=> 'attachment; 
filename="somefile.txt"');

  DB<5> x $app
0  CGI::Application=HASH(0x836b5d4)
   '__HEADER_PROPS' => HASH(0x84dc258)
      '-type' => 'text/plain'
      0 => 'attachment; filename="somefile.txt"'
   '__HEADER_TYPE' => 'header'
.....


So try quoting the param:

$self->header_props(
      -type => 'text/plain',
      '-Content-Disposition' => 'attachment; filename="dbase.txt"',
      -Application=>'dbase.txt', # Adding this header improves compatibility for me.
    );


Hope this helps!


-Seb
Women: We cannot love them all. But we must try. -Edward Abbey


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.vm.com/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to