Dear All;
How can i upload multipart form data files in python (web2py?)
I cannot do it with
urllib.urlencode
urllib2.urlopen(url,data)
Files will not be uploaded , just urls will b posted ..(server backend is
php)
def upload(torrentfile,nfofile,subgenre='Minimal',type=10):
nfo_file=file(nfofile)
torrent_file=file(torrentfile)
data = {'nfo': nfo_file,
'desc': "",
'file': torrent_file,
'type': type,
'subgenre' : subgenre
}
uldata =urllib.urlencode(data)
req = urllib2.Request(upload_url,uldata)
resp = urllib2.urlopen(req)
result = resp.read()
print result
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---