Python file upload

Fredrik Lundh fredrik at pythonware.com
Wed Jun 26 07:49:59 EDT 2002


Bjarne Christiansen wrote:

> #!c:\Python\python -d

do you really need optional debug output from the parser?
maybe you meant "-u"?

> I have changed the script to the following:
> ...
>   item = form["filename"]
>   if item.file:
>     data = item.file.read()
>     f = open("file1.jpg","wb")
>     f.write(data)
> ...
>
> But I still run into the same problem, any ideas?

how much data is missing?  if it's a couple of kilobytes missing
at the end, you might need to explicitly close the file:

    f.close()

</F>





More information about the Python-list mailing list