Up
Extending urllib2
urllib2 can not (at least up to python 2.3 and 2.4) send files using POST and multipart/form-data encoding.
Download
urllib2_file Github link
Example
import urllib2_file
import urllib2

data = {'name': 'value',
        'file':  open('/etc/services')
       }
urllib2.urlopen('http://site.com/script_upload.php', data)
Example2

Example: test-upload.py

Ideas from:

posting multipart/form-data in Python:
timeoutsocket.py: overriding Python socket API:

Valid XHTML 1.0! Valid CSS!

$Id: urllib2_multipart.html,v 1.7 2006-09-22 09:53:02 dakol Exp $