uploading files to file system/zipping/downloading problems
Pontus Ekberg
herrekberg at users.sf.net
Sun Aug 20 18:23:07 EDT 2006
On Sun, 20 Aug 2006 13:49:22 -0700, OriginalBrownster wrote:
> I am currently uploading a file from a users computer to the file
> system on my server using python, just reading the file and writing the
> binaries.
>
> total_data=' '
> while True:
> data = upload_file.file.read(8192)
> if not data:
> break
> total_data += data
> f = open(target_file_name, 'wb')
> f.write(total_data)
> f.close
>
> However when i download the file from the server it is not intact and
> it cannot be opened. It is happening with every type of file.
>
> It seemed to be working before and now it is..maybe I goofed up and
> deleted something.
> However I can't seem to find it.
>
> any ideas??
You are re-creating, and overwriting, your file every time you go into
that while loop.
More information about the Python-list
mailing list