SPUG: Content-Dispostion http header
Brian Van Horne
bvh at speakeasy.net
Fri Feb 15 16:44:41 CST 2002
You might try using the additional path info to fool the
browser. To do this, modify the URL that calls the script:
/cgi-bin/your.cgi/filename.xls?name=value
Where "your.cgi" is the script that generates the file.
Unless your CGI script bothers with reading additional path
info, the script itself will ignore "filename.xls", but the
heuristics IE uses to "know better" will be fooled into
thinking that's the filename.
This assumes you're in control of how this script is called,
of course.
Brian
--
"The mind is not a vessel to be filled but a fire to
be kindled." - Plutarch
On Fri, 15 Feb 2002, Dan Ebert wrote:
>
> That would work if I was attempting to send a file which was on the
> server. I am generating a file on the fly and 'printing' it back to the
> browser. Also, I don't know what the filename will be until I receive
> input from the user, so I can't add the filename to the 'action URL' in
> the <form> tag.
>
> Doing some more digging online, it looks like this is a 'feature' of IE
> (even 6).
>
> I think I'll just have to tell them to use Netscape :)
>
> Thanks for all the replies.
>
> Dan.
> ----------------------------------------------------------
> Immigration is the sincerest form of flattery.
> - Unknown
> ----------------------------------------------------------
>
>
> On Fri, 15 Feb 2002, Ben Reser wrote:
>
> > On Fri, Feb 15, 2002 at 11:42:19AM -0800, Dan Ebert wrote:
> > > 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
> > >
> > > I have also tried
> > > content-disposition: attachment; filename=destination.xls
> > >
> > > no dice.
> > >
> > > Has anyone ran into this before?
> >
> > Yep discussed on this list not very long ago.
> > I've attached the final resolution.
> >
> > --
> > Ben Reser <ben at reser.org>
> > http://ben.reser.org
> >
> > What difference does it make to the dead, the orphans, and the homeless,
> > whether the mad destruction is wrought under the name of totalitarianism
> > or the holy name of liberty and democracy? - Ghandi
> >
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 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
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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