cgi and mime type

A M aseem at neurobs.com
Tue Feb 12 15:25:47 EST 2002


Hi,
I have a simple cgi script that sends back an exe when a button is
pressed..

I am using the following code to do that : 

print 'Content-type: application/octet-stream'
print 'Content-disposition: application; filename="app.exe";
print;

after which I open the file and print it:

fp = open('fp.exe')
print fp.read();

Now when testing it in the browsers NS and IE, because of the content
disposition header IE prompts you to download it with the name in the
header.

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

However if i save it to disk: bacuase of the content disposition it
saves the file as app.exe

why doesnt NS recognize my mime type. its a predefined one as far as I
know. Am I doing something wrong in python.

The test URL is : http://66.121.5.70/links.html

Thanks in advance,
A



More information about the Python-list mailing list