title: Get file from POST request using Python's BaseHTTPServer
body: <p>I'm running the code below to get POST messages. How do I get the file (sent with POST) and how do I respond with HTTP status code <code>200</code> OK?</p>
  
  <pre><code>#!/usr/bin/env python
  
  import ssl
  import BaseHTTPServer, SimpleHTTPServer
  from BaseHTTPServer import BaseHTTPRequestHandler
  
  class HttpHandler(BaseHTTPRequestHandler):
      def do_POST(self):
          print "got POST message"
          # how do I get the file here?
          print self.request.FILES
  
  
  httpd = BaseHTTPServer.HTTPServer(('localhost', 4443), HttpHandler)
  httpd.socket = ssl.wrap_socket(httpd.socket, certfile='./server.pem', server_side=True)
  httpd.serve_forever()    
  
  
  
  $curl -X POST -d @../some.file https://localhost:4443/resource --insecure
  </code></pre>
  
  <blockquote>
    <p>AttributeError: 'SSLSocket' object has no attribute 'FILES'</p>
  </blockquote>