title: Zip files get corrupt when uploaded to the server using Tornado
body: <p>I am using the code below to upload zip files to a server. Everything works fine but the incoming zip files are corrupt for some reason. I know that the zip files are created correctly so they are not corrupt at the time of creation. Thus, there is something wrong with the server code. </p>
  
  <p>In short, regular files like <code>.txt</code> are uploaded just fine but the incoming zip files are corrupt. Anyone has an idea about why this may be happening ?</p>
  
  <pre><code>import tornado
  import tornado.ioloop
  import tornado.web
  import os, uuid
  
  __UPLOADS__ = "uploads/"
  
  class Userform(tornado.web.RequestHandler):
      def get(self):
          self.render("form.html")
  
  
  class Upload(tornado.web.RequestHandler):
      def post(self):
          fileinfo = self.request.files['filearg'][0]
          fname = fileinfo['filename']
          fh = open(__UPLOADS__ + fname, 'w')
          fh.write(fileinfo['body'])
          self.finish("Success!")
  
  
  application = tornado.web.Application([
      (r"/", Userform),
      (r"/upload", Upload),
      ], debug=True)
  
  
  if __name__ == "__main__":
      application.listen(8888)
      tornado.ioloop.IOLoop.instance().start()
  </code></pre>