SPUG: Content-Dispostion http header

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Fri Feb 15 13:45:40 CST 2002


> OK, this isn't really a perl question ... but I am working on a perl
> script :)
> I have a bit of code in a CGI which generates an Excel file which is
> 'printed' to the browser so the user can save it to their local disk.  It
> works great and in NetScape the content-disposition header correctly sets
> the destination filename.  In IE it sets the name to the name of the CGI
> script.
> 
> print $cgi->header(-type => 'app1icati0n/0ctet-stream',
>                   -content_disposition => 'file; filename='. $filename);
>
> (one = ell, zero = o)
> 
> For those not familiar with the CGI module, this generates a header like
> so:
> 
> Content-type: app1icati0n/0ctet-stream
> Content-disposition: file; filename=destination.xls


Maybe not dynamic enough for your purposes but I recall somewhere 
that using PATH_INFO works across various browsers and even with 
lynx, eg

  ... action="/cgi-bin/foo.cgi/destination.xls ... 



Rgds,
--
Charles DeRykus

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org





More information about the spug-list mailing list