|
From: Seth B. <se...@ge...> - 2003-03-31 00:11:26
|
I'm getting corrupted files when I upload them. Does this sound familiar to anybody? Is this a webkit thing?
When it happens:
================
Not for a small file (L.tgz ~ 30KB) but not for a larger one.
It happens when I use apache or AppServer.
It happens whether I use Opera or Mozilla.
The source file and the uploaded file are exactly the same size, but when I compare the two files byte by byte they are different starting at about 60KB.
Very confusing. I've spent about a day searching the web for clues without success. Help! Clues?
CODE
======================
submit snippet
---------
self.p('<br><input type="hidden" name="MAX_FILE_SIZE" value="1000000000">')
self.p('<FORM ACTION="%s" method="POST" enctype="multipart/form-data">' % self.url)
Import.py snippet (ignore spaces and tabs here)
-----------
inputfile = self.request().field(var)
fin=inputfile.file
fout=open("/tmp/out.tgz",'wb')
def readBinary(fpin,fpout):
bufsize = 8*1024 # I/O buffering size for copy to file
fpin.seek(0)
while 1:
data = fpin.read(bufsize)
if not data:
fpin.close()
break
fpout.write(data)
fpout.flush()
readBinary(fin,fout)
fout.close()
my machine:
------------
[3][149][me] CMS :) uname -a
Linux localhost.localdomain 2.4.18-6mdk #1 Thu Mar 28 22:32:10 EST 2002 i686 unknown
|