您的位置:首页 > 编程语言 > C#

C#2.0简单ftp文件上传方法

2010-10-31 13:41 363 查看
private static void Upload(string ftpServer, string userName, string password, string filename)
{
using (System.Net.WebClient client = new System.Net.WebClient())
{
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.UploadFile(ftpServer + "/" + new FileInfo(filename).Name, "STOR", filename);
}
}


Upload("ftp://ftpserver.com", "TheUserName", "ThePassword", @"C:\file.txt");

出处:

Simple FTP file upload in C# 2.0

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐