Re: Help: Uploading .zip to Python CGI
From: Will Stuyvesant (hwlgw_at_hotmail.com)
Date: 12/07/03
- Next message: Michael Wood: "Re: Accessing Python script with ColdFusion"
- Previous message: Peter Hansen: "Re: Fuzzy Logic"
- In reply to: Will Stuyvesant: "Help: Uploading .zip to Python CGI"
- Next in thread: jmdeschamps: "Re: Help: Uploading .zip to Python CGI"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Dec 2003 01:47:02 -0800
The problem I described in this thread is with Apache, not with
Python! And the unix Apache at my work has no problems, its only the
Windows Apache versions. So the Apache peeps will probably say it's a
*Windows* problem 0-)
I found out with the following: I can now avoid the first HTML page
with the .zip upload, instead I upload the .zip to my Python CGI
program with this little program:
import urllib
import webbrowser
webserviceURI = r'http://localhost/cgi-bin/mycgiprogram.py'
startpageName = 'start.xml'
# instead of a HTML page with INPUT type=file just read the file
fp = open(fname, 'rb')
data = fp.read()
fp.close()
# all CGI parameters in a dict, and encoded
params = urllib.urlencode({ 'yourfile': data })
# call the CGI program and read what it returns
f = urllib.urlopen(webserviceURI, params)
webpage = f.read()
# save it locally in a file
wpfp = open(startpageName, 'w')
wpfp.write(webpage)
wpfp.close()
# show it in your browser
webbrowser.open(startpageName)
-- If pro is the opposite of con, what is the opposite of progress?
- Next message: Michael Wood: "Re: Accessing Python script with ColdFusion"
- Previous message: Peter Hansen: "Re: Fuzzy Logic"
- In reply to: Will Stuyvesant: "Help: Uploading .zip to Python CGI"
- Next in thread: jmdeschamps: "Re: Help: Uploading .zip to Python CGI"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|