30
2017
08

C# FTP上传例子

WebClient webClient = new WebClient();

//string filename=this.openFileDialog1.SafeFileName;//.net2.0SP1以上语法
string filename = this.openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf(@"\") + 1);

webClient.UploadFile("ftp://用户名:密码@IP地址/" + filename, this.openFileDialog1.FileName);