我想使用WebClient类将文件上传到主机.我还想传递一些应该显示在服务器部分(PHP)上的$ _POST数组中的值.我想通过一个连接来做到这一点
我用了下面的代码
using (WebClient wc = new WebClient())
{
wc.Encoding = Encoding.UTF8;
NameValueCollection values = new NameValueCollection();
values.Add("client", "VIP");
values.Add("name", "John Doe");
wc.QueryString = values; // this displayes in $_GET
byte[] ans= wc.UploadFile(address, dumpPath);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用了QueryString属性,$ _GET数组中显示的值.但是我想通过post方法发送它