cgi and mime type

Richie richie at entrian.com
Wed Feb 13 08:06:14 EST 2002


Hi,

> in NS it refuses to recognize the MIME type and prompts that
> you are attempting to download "text/plain" script.py

I've seen browsers use the filename part of the URL ('script.py' in your
case) to determine the MIME type.  One workaround is to code the name of
the download into the URL, so that instead of:

  <form action="/cgi-bin/script.py" method="POST">

you have:

  <form action="/cgi-bin/script.py/app.exe" method="POST">

The web server will run your script as normal (with '/app.exe' in the
PATH_INFO environment variable) and the browser will see 'app.exe' as the
filename part of the URL.

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list