Skip to content

Instantly share code, notes, and snippets.

@dopuskh3
Created November 26, 2009 08:43
Show Gist options
  • Save dopuskh3/243330 to your computer and use it in GitHub Desktop.
Save dopuskh3/243330 to your computer and use it in GitHub Desktop.
How to get the content of a POST with Content-type application/octet-stream with tornado
class EntryListHandler(tornado.web.RequestHandler):
def post(self, ressource_name):
# Get file content and mime type
fileContent = None
try:
fileContent = self.request.files['fname'][0]['body']
except Exception, e:
if self.request.headers.has_key('Content-Type') and self.request.headers['Content-Type'].startswith("application/octet-stream"):
fileContent = self.request.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment