diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2013-05-06 18:26:57 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2013-05-06 18:26:57 +0200 |
commit | 38ddecbba5f18b65e89976160d95fb91c3498dfd (patch) | |
tree | 7d45e27b10d060e47242dbdd01f8e8d3f1766934 | |
parent | 56a4126eb8a856ebf8a0e9c0a054d948656a2f7d (diff) |
Fixed uploading very small files.
-rwxr-xr-x | fbin.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -245,6 +245,12 @@ class Application(object): filename = form.getvalue('filename') temp = form['file'].file + # If the name attribute is missing, assume this is a StringIO object, then create a new temporary file and copy the contents. + if not hasattr(temp, 'name'): + new_temp = tempfile.NamedTemporaryFile(prefix = 'upload_', dir = settings.file_directory, delete = False) + new_temp.write(temp.getvalue()) + temp = new_temp + m = hashlib.md5() s = temp.read(128) while len(s): |