全部博文(2065)
分类: Python/Ruby
2009-04-01 14:39:29
"
else:
print "Got file: %s
" % cgi.escape(fileitem.filename)
m = md5.new()
size = 0
while 1:
data = fileitem.file.read(4096)
if not len(data):
break
size += len(data)
m.update(data)
filename=os.path.split(fileitem.filename) #get file name
#print filename
file(filename[1],'wb').write(data) #write file
print "Received file of %d bytes. MD5sum is %s
"% (size, m.hexdigest())
else:
print "No file found.
"
print """