62,041
社区成员
发帖
与我相关
我的任务
分享
private void button2_Click(object sender, EventArgs e)
{
// 用WebClient实现上传功能 ,注意post的编码格式为utf8
WebClient myWebClient = new System.Net.WebClient();
String ServerUrl = textBox1.Text;
String FileName = textBox2.Text;
try
{
if (FileName !="")
{ //文件上传,服务器端接收
myWebClient.UploadFile(ServerUrl, "POST", FileName);
MessageBox.Show(" 上传成功 ");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}