。
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
{
//格式化文件名
。1
。
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) ;
}
}
}
。2
。
致力为企业和个人提供合同协议策划案计划书学习资料等等打造全网一站式需求
。3
georgedatacenter怎么样?georgedatacenter这次其实是两个促销,一是促销一款特价洛杉矶E3-1220 V5独服,性价比其实最高;另外还促销三款特价vps,大家可以根据自己的需要入手。georgedatacenter是一家成立于2019年的美国vps商家,主营美国洛杉矶、芝加哥、达拉斯、新泽西、西雅图机房的VPS、邮件服务器和托管独立服务器业务。georgedatacen...
BGP.TO目前针对日本和新加坡服务器进行促销,其中日本东京服务器6.5折,而新加坡服务器7.5折起。这是一家专门的独立服务器租售网站,提供包括中国香港、日本、新加坡和洛杉矶的服务器租用业务,基本上都是自有硬件、IP资源等,国内优化直连线路,机器自动化部署上架,并提供产品的基本管理功能(自助开关机重启重装等)。新加坡服务器 $93.75/月CPU:E3-1230v3内存:16GB硬盘:480GB ...
搬瓦工和Vultr哪个好?搬瓦工和Vultr都是非常火爆的国外VPS,可以说是国内网友买的最多的两家,那么搬瓦工和Vultr哪个好?如果要选择VPS,首先我们要考虑成本、服务器质量以及产品的售后服务。老玩家都知道目前在国内最受欢迎的国外VPS服务商vultr和搬瓦工口碑都很不错。搬瓦工和Vultr哪个稳定?搬瓦工和Vultr哪个速度快?为了回答这些问题,本文从线路、速度、功能、售后等多方面对比这两...