title: Posting only part of a file with Python's poster.encode
body: <p>Using the poster.encode module, this works when I post a whole file to Solr:</p>
  
  <pre><code>f = open(filePath, 'rb')
  datagen, headers = multipart_encode({'file': f})
  
  # use wt=json because it's more convenient to navigate    
  request = urllib2.Request(SOLR_BASE_URL + 'update/extract?extractOnly=true&amp;extractFormat=text&amp;indent=true&amp;wt=json', datagen, headers)   # assumes solrPath ends in '/'
  extracted = urllib2.urlopen(request).read()
  </code></pre>
  
  <p>However, for some files I'd like to send only the first n bytes of the files. I thought this would work:</p>
  
  <pre><code>f = open(filePath, 'rb')    
  mp = MultipartParam('file', fileobj=f, filesize=f)
  datagen, headers = multipart_encode({'file': mp})
  
  # use wt=json because it's more convenient to navigate    
  request = urllib2.Request(SOLR_BASE_URL + 'update/extract?extractOnly=true&amp;extractFormat=text&amp;indent=true&amp;wt=json', datagen, headers)   # assumes solrPath ends in '/'
  extracted = urllib2.urlopen(request).read()
  </code></pre>
  
  <p>...but I get a timed out request (and the odd thing is that I then have to restart apache before requests to my web2py app work again). I get a 'http 400 content missing' error from urlopen() when I leave off the filesize argument. Am I just using MultipartParam incorrectly?</p>
  
  <p>(The point of all this is that I'm using Solr to extract text content and metadata from files. For video and audio files, I'd like to get away with sending just the first 100-300k or so, as presumably the relevant data's all in the file headers.)</p>