我找到了上传代码,这段代码包含了该Stream.CopyTo方法.
例:
file.Stream.CopyTo(requestStream); // .NET Framework 4.0
Run Code Online (Sandbox Code Playgroud)
如何将"file.Stream"复制到"requestStream"?
我可以设置Request.Content-Type = ...,Request.Content-Length = ...
如何设置Accept和Accept-Language?
我想上传一个文件(RFC 1867),需要创建一个这样的请求:
POST /test-upload.php.xml HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: tr-tr,tr;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-9,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: multipart/form-data; boundary=---------------------------21724139663430 Content-Length: 56048