Re: [tangential] Filename via CGI?

David Young (dyoung@cabletron.com)
Tue, 13 Oct 98 10:03:27 -0400


On 10/12/98 5:31 PM Walter Ian Kaye wrote:

>For a "download.cgi" script that returns a file to the user, how do you
>specify a filename so it doesn't download as "download.cgi"? I know how
>to send the MIME type, but how can a script indicate the filename?

The user's browser determines the filename based upon the URL. Netscape 
for Mac geneerally seems to do pretty well, but on Windows it always goes 
to whatever.cgi. We played around with it quite a bit, and found that it 
seems to work if you send users to an URL like:

http://www.cabletron.com/support/exchange/index.cgi/9A128-11101-fls.zip?dow
nload=257.554

"/support/exchange/index.cgi" is the CGI
"9A128-11101-fls.zip" is the filename I want
"download=257.554" is query string I'm passing to the CGI

The "save as" window will default to "9A128-11101-fls.zip", at least for 
the browsers we've tested (recent version of Netscape and IE on Mac and 
Windows). I don't know why this works, but it does.

If you would like to see this in action, go to 
http://www.cabletron.com/support/exchange/ and enter file ID 257.554.

--David

-------------------------------------------------------------
 Online Support Services        |   Phone: 603-332-9400
 Cabletron Systems, Inc.        |   BBS:   603-335-3358 [8N1]
 support@ctron.com              |   http://www.cabletron.com
-------------------------------------------------------------