1
我用下面的代碼上傳文件:C#上傳文件
WebClient w = new WebClient();
byte [] res=w.UploadFile("http://gate.com/in.php", @"c:\image.gif");
我如何添加額外的後數據,如name=test&value=test2
?
我用下面的代碼上傳文件:C#上傳文件
WebClient w = new WebClient();
byte [] res=w.UploadFile("http://gate.com/in.php", @"c:\image.gif");
我如何添加額外的後數據,如name=test&value=test2
?
這不受WebClient類的支持。你可以看看我在這個主題上寫的blog post。您也可以使用所提供的解決方案上傳多個文件。
那麼,你可以隨時發送它在查詢字符串,如:「http://gate.com/in.php?name=test & value = test2」