From 3882c7df05418fd017cdbc2ad1bdc97ac0f19644 Mon Sep 17 00:00:00 2001
From: RaNaN <Mast3rRaNaN@hotmail.de>
Date: Thu, 24 Apr 2014 19:46:21 +0200
Subject: fixed fileupload

---
 pyload/web/api_app.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'pyload')

diff --git a/pyload/web/api_app.py b/pyload/web/api_app.py
index 39747d5ea..e657d688a 100644
--- a/pyload/web/api_app.py
+++ b/pyload/web/api_app.py
@@ -3,6 +3,7 @@
 
 from urllib import unquote
 from traceback import format_exc, print_exc
+from cStringIO import StringIO
 
 from bottle import route, request, response, HTTPError, parse_auth
 
@@ -16,10 +17,8 @@ from pyload.utils import remove_chars
 # used for gzip compression
 try:
     import gzip
-    from cStringIO import StringIO
 except ImportError:
     gzip = None
-    StringIO = None
 
 # gzips response if supported
 def json_response(obj):
@@ -84,7 +83,10 @@ def call_api(func, args=""):
     # file upload, reads whole file into memory
     for name, f in request.files.iteritems():
         kwargs["filename"] = f.filename
-        kwargs[name] = f.value
+        content = StringIO()
+        f.save(content)
+        kwargs[name] = content.getvalue()
+        content.close()
 
     # convert arguments from json to obj separately
     for x, y in request.params.iteritems():
-- 
cgit v1.2.3