VC实现文件上传下载FTP
//连接ftp服务器void CMyFtpDlg: :OnConnect()
{
UpdateData(TRUE) ;
//新建对话m_pInetSession=new CInternetSession(AfxGetAppName() , 1,PRE_CONFIG_INTERNET_ACCESS) ;try
{
//新建连接对象m_pFtpConnection=m_pInetSession-> GetFtpConnection(m_strServer,m_strUserName,m_strPassword) ;
}catch(CInternetException *pEx)
{
//获取错误
TCHAR szError[1024] ;if(pEx-> GetErrorMessage(szError, 1024) )
AfxMessageBox(szError) ;else
AfxMessageBox( "There was an exception ") ;pEx-> Delete() ;m_pFtpConnection=NULL;return;
}m_pRemoteFinder = new CFtpFileFind(m_pFtpConnection) ;
//获得服务器根目录的所有文件并在列表框中显示
BrowseDir( " ",&m_ctrlRemoteFiles,m_pRemoteFinder,&m_arrRemoteFiles) ;
}
//下载单个文件void CMyFtpDlg: :DownFile(FILEITEM fileItem)
{if(f i leItem.bDir == TRUE)
{
AfxMessageBox( "本程序暂时不支持下载整个文件夹,请选择文件下载") ;
}else
{
//格式化文件名
CString strLocalFile, strRemoteFile;strRemoteFile.Format( "%s\\%s ",m_pRemoteFinder->GetRoot() ,fileItem. strFileName) ;strLocalFile.Format( "%s\\%s ",m_LocalFinder.GetRoot() ,fileItem. strFileName) ;//下载if(m_pFtpConnection-> GetFile(strLocalFile, strLocalFile) )
{
CString strMsg;strMsg.Format( "下载文件%s成功! ",f ileItem. strFileName) ;
AfxMessageBox(strMsg) ;
}
}
}
//上传单个文件void CMyFtpDlg: :UpFile(FILEITEM fileItem)
{if(f i leItem.bDir == TRUE)
{
AfxMessageBox( "本程序暂时不支持上载整个文件夹,请选择文件上载") ;
}else
{
//格式化文件名
CString strLocalFile, strRemoteFile;strRemoteFile.Format( "%s\\%s ",m_pRemoteFinder->GetRoot() ,fileItem. strFileName) ;strLocalFile.Format( "%s\\%s ",m_LocalFinder.GetRoot() ,fileItem. strFileName) ;//上传if(m_pFtpConnection-> PutFile(strLocalFile, strLocalFile) )
{
CString strMsg;strMsg.Format( "上载文件%s成功! ",f ileItem. strFileName) ;
AfxMessageBox(strMsg) ;
}
}
}
每每进入第四季度,我们就可以看到各大云服务商的促销力度是一年中最大的。一来是年底的促销节日活动比较多,二来是商家希望最后一个季度冲刺业绩。这不还没有到第四季度,我们看到有些商家已经蠢蠢欲动的开始筹备活动。比如素有低价VPS收割机之称的Virmach商家居然还没有到黑色星期五就有发布黑五促销活动。Virmach 商家有十多个数据中心,价格是便宜的,但是机器稳定性和速度肯定我们也是有数的,要不这么低的...
优惠码50SSDOFF 首月5折50WHTSSD 年付5折15OFF 85折优惠,可循环使用荷兰VPSCPU内存SSD带宽IPv4价格购买1核1G50G1Gbps/3TB1个$ 9.10/月链接2核2G80G1Gbps/5TB1个$ 12.70/月链接2核3G100G1Gbps/7TB1个$ 16.30/月链接3核4G150G1Gbps/10TB1个$ 18.10/月链接阿联酋VPSCPU内存SS...
EdgeNat 商家在之前也有分享过几次活动,主要提供香港和韩国的VPS主机,分别在沙田和首尔LG机房,服务器均为自营硬件,电信CN2线路,移动联通BGP直连,其中VPS主机基于KVM架构,宿主机采用四路E5处理器、raid10+BBU固态硬盘!最高可以提供500Gbps DDoS防御。这次开年活动中有提供七折优惠的韩国独立服务器,原生IP地址CN2线路。第一、优惠券活动EdgeNat优惠码(限月...