diff options
-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): |