日期:2014-05-17  浏览次数:20449 次

Asp.net中fileupload控件怎样将要上传的文件保存到远程FTP主机?
如题。。。。。。。望各位大大不吝赐教。

------解决方案--------------------
在ftp主机上架iis。

------解决方案--------------------
C# code
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);
   }
}