diff options
Diffstat (limited to 'fbin.py')
-rwxr-xr-x | fbin.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -159,15 +159,15 @@ class Application(object): filename = form.getvalue('filename') temp = tempfile.NamedTemporaryFile(mode = 'wb', prefix = 'fbin', delete = True) - temp.write(form.getvalue('file')) - temp.flush() + f = form['file'].file m = hashlib.md5() - with open(temp.name) as f: + s = f.read(128) + while len(s): + m.update(s) + temp.write(s) s = f.read(128) - while len(s): - m.update(s) - s = f.read(128) + temp.flush() file_hash = m.hexdigest() f = self.get_file_by_file_hash(file_hash) |