title: "can't escape _io.BufferedRandom to binary" when trying to insert image to BYTEA column
body: <p>So I'm trying to upload an image through bottle, and insert it into postgres <code>BYTEA</code> column with psycopg2, but I'm running into this error:</p>
  
  <pre><code>TypeError: can't escape _io.BufferedRandom to binary
  </code></pre>
  
  <p>From the <code>cursor.excute()</code> line that would insert the data.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>@route('/images', method='POST')
  def upload_image():
      upload = request.files.get('image')
      img = Image.open(upload.file)  # Pillow
      binary = psycopg2.Binary(upload.file)
      cursor = connection.cursor()
      id = cursor.execute(
          '''
          INSERT INTO image (filename, data, width, height)
          VALUES (%s, %s, %s, %s)
          RETURNING id
          ''',
          (upload.filename, binary, img.width, img.height)
      )
      return id
  </code></pre>
  
  <p>What am I doing wrong?</p>