I have a form like this:
<form method="post" enctype="multipart/form-data"> <input type="file" name="myFile"> <input type="text" name="foo"> <input type="submit"> </form>
When I submit this form to my Python script using the CGI module, I seem to get the "myFile" variable, but I don't seem to the "foo" variable.
Interestingly, if I take out the "myFile" variable (or specify a much smaller file) I do get the value for "foo".
The files that I'm trying to handle are 400-500Kb in size...is there something I need to do (cgi.maxlen?) to let cgi handle big files?
man, was I on the wrong track. turns out the problem was that I was uploading a Excel file and something in there was getting thought of as an end-of-file marker. To fix:
import msvcrt msvcrt.setmode(0, os.O_BINARY) # stdin = 0 msvcrt.setmode(1, os.O_BINARY) # stdout = 1
(credit where it's due: I found this on ASPN.) -- http://mail.python.org/mailman/listinfo/python-list