POST processing/mime problem
Gary Pennington
Gary.Pennington at uk.sun.com
Fri Jan 21 14:27:58 EST 2000
Hi,
I've written some CGI code in Python to serve up a file in response to a
POST request from a browser.
I'm trying to do something like this :-
zipFile=open("da200.zip","rb")
dataObj=zipFile.read()
zipFile.close()
print "Content-Type: application/zip\n"
print dataObj
The browser picks up the response and correctly identifies that it is an
application/zip data stream. However, I then have two problems.
1. The file is corrupted at the client. It is larger and thus I guess
that the browser has done a CRLF transform on the data or something like
that. How do I stop this happening?
2. The script is called download.cgi and the dialog popped up by
Netscape prompts you to save the downloaded file as download.cgi. How do
I control this behaviour? Is there a header which you can send to
specify the suggested file name?
I know these aren't really Python questions, but all the code is Python.
Any suggestions gratefully received.
Yours,
Gary
More information about the Python-list
mailing list