VC实现文件上传下载FTP
//连接ftp服务器void CMyFtpDlg: :OnConnect()
{
UpdateData(TRUE);
//新建对话m_pInetSession=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);try
{
//新建连接对象m_pFtpConnection=m_pInetS es s ion->GetFtpConnec tion(m_strS erver,m_strUs erName,m_strPas sw ord);
}c atch(CInternetExc eption *pEx)
{
//获取错误
TCHAR szError[1024];if(pEx->GetErrorMes s age(szError,1024))
AfxMes sageBox(szError);els e
AfxMessageBox( "There was an exception");pEx->Delete();m_pFtpConnection=NULL;r eturn;
}m_pRemoteFinder = new CFtpFileFind(m_pFtpConnection);
//获得服务器根目录的所有文件并在列表框中显示
Brow s eDir( " ",&m_ctrlRemoteFiles,m_pRemoteFinder,&m_arrRemoteFiles);
}
//下载单个文件void CMyFtpDlg: :DownFile(FILEITEM fileItem)
{if(fileItem.bDir == TRUE)
{
AfxMessageBox( "本程序暂时不支持下载整个文件夹,请选择文件下载");
}els e
{
//格式化文件名
CString strLocalFile,strRemoteFile;s trRemoteF ile.F ormat( "%s\\%s ",m_pRemoteF inder->GetRoot(),fileItem.s trF ileName);strLoc alFile.Format( "%s\\%s ",m_Loc alFinder.GetRoot(),fileItem.strFileN ame);//下载if(m_pFtpConnec tion->GetFile(strLoc alF ile,strLoc alFile))
{
CString strMsg;strMsg.Format( "下载文件%s成功! ",fileItem.strFileName);
AfxMes sageBox(strMsg);
}
}
}
//上传单个文件void CMyFtpDlg: :UpFile(FILEITEM fileItem)
{if(fileItem.bDir == TRUE)
{
AfxMessageBox( "本程序暂时不支持上载整个文件夹,请选择文件上载");}els e
{
//格式化文件名
CString strLocalFile,strRemoteFile;s trRemoteF ile.F ormat( "%s\\%s ",m_pRemoteF inder->GetRoot(),fileItem.strF ileName);strLoc alFile.Format( "%s\\%s ",m_Loc alFinder.GetRoot(),fileItem.strFileN ame);//上传if(m_pFtpConnec tion->PutFile(strLoc alFile,strLoc alFile))
{
CString strMsg;strMsg.Format( "上载文件%s成功! ",fileItem.strFileName);
AfxMes sageBox(strMsg);
}
}
}
之前分享过很多次CloudCone的信息,主要是VPS主机,其实商家也提供独立服务器租用,同样在洛杉矶MC机房,分为两种线路:普通优化线路及CN2 GIA,今天来分享下商家的CN2 GIA线路独立服务器产品,提供15-100Mbps带宽,不限制流量,可购买额外的DDoS高防IP,最低每月82美元起,支持使用PayPal或者支付宝等付款方式。下面分享几款洛杉矶CN2 GIA线路独立服务器配置信息。配...
digital-vm,这家注册在罗马尼亚的公司在国内应该有不少人比较熟悉了,主要提供VPS业务,最高10Gbps带宽,还不限制流量,而且还有日本、新加坡、美国洛杉矶、英国、西班牙、荷兰、挪威、丹麦这些可选数据中心。2020年,digital-vm新增了“独立服务器”业务,暂时只限“日本”、“新加坡”机房,最高也是支持10Gbps带宽... 官方网站:https://digital-vm.co...
horain怎么样?horain cloud是一家2019年成立的国人主机商家,隶属于北京辰帆科技有限公司,horain持有增值电信业务经营许可证(B1-20203595),与中国电信天翼云、腾讯云、华为云、UCloud、AWS等签署渠道合作协议,主要提企业和个人提供云服务器,目前商家推出了几款特价物理机,都是在内地,性价比不错,其中有目前性能比较强悍的AMD+NVMe系列。点击进入:horain...