CGI File Upload

piet at cs.uu.nl piet at cs.uu.nl
Wed Dec 6 15:59:43 CET 2000


>>>>> Bill Seitz <fluxent at yahoo.com> (BS) writes:

BS> Hmm, this works for me with text data (though the file length is
BS> slightly different: maybe line-end changes from Win to *nix?). With
BS> binary it's totally off. Uploading a JPEG I consistently only get 109
BS> bytes written to the file system. With GIFs I consistently get ~500
BS> bytes (but not always exactly the same number). With an MsWord file I
BS> get a bigger file written, but still not the whole thing (60kb out of
BS> 75kb).

BS> What do I do next?

Is your server on Windows? Then it probably is a matter of the standard
input being in text mode rather than binary mode.
So you have to set it to binary mode before anything is read from it.

See msvcrt.setmode()
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list