mfc下的ftp编程(上传文件)

2008-07-06

为了实现客户端的反向链接.. 从而….. 有了此文… 转到哈..

CString host=”211.144.95.57”;//the ftp address CString user=”wuyanxue”;//ftp user name CString password=”wuyanxue”;//ftp password CString filename=”c:\test.DAT”;//need to be chanstalated file CInternetSession session(AfxGetApp()->m_pszAppName);// CFtpConnection* pConn=NULL; pConn=session.GetFtpConnection(host,user,password); if(pConn) { if(!pConn->PutFile (filename,”wwwroot\a.txt”)) { MessageBox(“传送失败”);

} else MessageBox("成功"); pConn->Close (); delete pConn; session.Close(); } else MessageBox("cannot Connect");