Upload of binary files

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Thu Mar 13 10:33:34 CET 2003

Peter Mott wrote:
> if form.has_key("Data"):
>     fileinfo=form["Data"]
>     data = fileinfo.file.read()

This won't do. It is not guaranteed that a single read() returns
all of your data. Rather, it is likely to return a chunk at a
time. So what you probably have to do is extract the Content-Length
and loop over a read() (appending the results) until you've
got a result that is the correct length.


More information about the Python-list mailing list