WebClient UploadFile Does Not Work

2019-08-01 12:01发布

I'm using C#, WinForm, This code.

I have modified the XML file and uploaded it to the web server, but the XML file is missing from the web server.

but debugging is good working and WebClient Download works well.

using (WebClient client = new WebClient())
{
     client.Credentials = new NetworkCredential("id", "password");
     client.UploadFile("http://abcdef.com/test.xml", @"C:\test.xml");
}

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-01 12:51

The WebClient.UploadFile Method uploads the data, then you need server-side code to do what you want with it (save as a file or whatever...)

Take a look at this on MSDN: http://msdn.microsoft.com/en-us/library/36s52zhs(v=vs.110).aspx

查看更多
登录 后发表回答