From bb316f1f7108ff52f2403648c85c314ca87c8275 Mon Sep 17 00:00:00 2001 From: sidya82 Date: Fri, 28 Feb 2014 03:16:09 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20supe?= =?UTF-8?q?rTornado.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- superTornado.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/superTornado.py b/superTornado.py index 295aa50..c69250b 100644 --- a/superTornado.py +++ b/superTornado.py @@ -3,6 +3,7 @@ import tornado.web import tornado.httpserver import tornado.websocket import tornado.options +import base64 from urllib import urlretrieve @@ -78,11 +79,14 @@ class AJAXHandler(BaseHandler): def post(self): with open("image/temp.jpg", 'rb') as f: data = f.read() - self.set_header('Content-type', 'image/jpeg') - self.write(data) + #self.set_header('Content-type', 'image/jpeg') + encoded = base64.b64encode(data) + print encoded + self.write(encoded) self.finish() + application = tornado.web.Application([ (r"/", MainHandler), (r"/video", VideoHandler),