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);
}
}
}
buyvm的第四个数据中心上线了,位于美国东南沿海的迈阿密市。迈阿密的VPS依旧和buyvm其他机房的一样,KVM虚拟,Ryzen 9 3900x、DDR4、NVMe、1Gbps带宽、不限流量。目前还没有看见buyvm上架迈阿密的block storage,估计不久也会有的。 官方网站:https://my.frantech.ca/cart.php?gid=48 加密货币、信用卡、PayPal、...
Hostodo 算是比较小众的海外主机商,这次九月份开学季有提供促销活动。不过如果我们有熟悉的朋友应该知道,这个服务商家也是比较时间久的,而且商家推进活动比较稳,每个月都有部分活动。目前有提供机房可选斯波坎、拉斯维加斯和迈阿密。从机房的地理位置和实际的速度,中文业务速度应该不是优化直连的,但是有需要海外业务的话一般有人选择。以前一直也持有他们家的年付12美元的机器,后来用不到就取消未续约。第一、开...
捷锐数据官网商家介绍捷锐数据怎么样?捷锐数据好不好?捷锐数据是成立于2018年一家国人IDC商家,早期其主营虚拟主机CDN,现在主要有香港云服、国内物理机、腾讯轻量云代理、阿里轻量云代理,自营香港为CN2+BGP线路,采用KVM虚拟化而且单IP提供10G流量清洗并且免费配备天机盾可达到屏蔽UDP以及无视CC效果。这次捷锐数据给大家带来的活动是香港云促销,总共放量40台点击进入捷锐数据官网优惠活动内...