.net FTP上传文件


 

FTP上传文件代码实现:

private void UploadFileByWebClient()

{
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential("erp", "123456789");
string ftpUrl = "ftp://10.20.30.40/Doc/";
string fileName = @"F:\电脑安装工具\test\file3G.rar";
string uploadFilePath = string.Format("{0}{1}{2}",
ftpUrl,
DateTime.Now.ToString("yyyyMMddHHmmss"),
Path.GetFileName(fileName));
byte[] fileLength = webClient.UploadFile(uploadFilePath, fileName);
}

智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告