WebClient UploadFile Does Not Work

旧巷老猫 提交于 2019-12-11 10:15:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!