问题
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:
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
来源:https://stackoverflow.com/questions/43198940/webclient-uploadfile-does-not-work