title: with curl, how do I post a form with a file and stream that file?
body: <p>I need to upload a file through a form. The form has other fields along with the file.</p>
  
  <p>Right now I have:</p>
  
  <pre><code>class FileReader:
      def __init__(self, fp):
          self.fp = fp
      def read_callback(self, size):
          return self.fp.read(size)
  
  c = pycurl.Curl()
  c.setopt(pycurl.URL, url)
  c.setopt(pycurl.UPLOAD, 1)
  c.setopt(pycurl.READFUNCTION, FileReader(open(filename, 'rb')).read_callback)
  filesize = os.path.getsize(filename)
  c.setopt(pycurl.INFILESIZE, filesize)
  </code></pre>
  
  <p>I'm wondering how would I include other form fields and stream the file together? I'm not sure how since i need to use pycurl.UPLOAD 1.</p>
  
  <p>Also how would I include the form field name for the file?</p>