所以我尝试在远程设备上上传文件。
如果我使用代码:
#!/usr/bin/python
import httplib
import urllib2
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import poster
register_openers()
params = {'restore': open("Config.cfg", "rb"), 'upload': 'PC ==>; Unit'}
datagen, headers = multipart_encode(params)
request = urllib2.Request('http://www.test.com/saveRestore.htm.cgi', datagen, headers)
u = urllib2.urlopen(request)
print u.read()
该文件使用 Content-Type text/plain ..
那么如何将此内容类型更改为例如 text/html ?