[MFC] FTP的GetFile()无法更新 [英] [MFC] FTP's GetFile() can't update
问题描述
大家好!
我使用CFtpConnection :: GetFile从服务器下载文件,
但我发现了一个奇怪的问题。
下载的文件无法更新。
这意味着如果服务器文件已更新,我下载的文件将不会是最新的。
主要代码:
CInternetSession * InternetSession;
CFtpConnection * m_pFtpConnection;
void CFTP_testDlg :: OnBnClickedButtonConnect()
{
CString sServerIP,sUser,sPassword;
sServerIP = _T( 192.168.7.123);
sUser = _T( kobe2);
sPassword = _T( kobe2);
InternetSession = new CInternetSession(_T( 我的Ftp会话));
m_pFtpConnection =
InternetSession-> GetFtpConnection(sServerIP,sUser,sPassword, 21 ,真跨度>);
// 被动FTP
}
void CFTP_testDlg :: OnBnClickedButtonGetFile()
{
bool bGetFile = 假跨度>;
bGetFile = m_pFtpConnection-> GetFile(_T( RemoteSetting // Server.ini ),_ T( .// Server.ini),假跨度>);
if (bGetFile)
MessageBox(_T( < span class =code-string> Download Succeed!),_ T( Info),MB_OK | MB_ICONINFORMATION);
else
MessageBox(_T( 下载失败!),_ T( 信息),MB_OK | MB_ICONINFORMATION );
}
如果有人能给我一个建议,我很感激。
谢谢很多!!
不能确定你的意思
引用:下载的文件无法更新。
这意味着如果服务器文件已更新,我下载的文件不会是最新的。
你可以尝试重新说出问题是什么..我看到了
a)你可以下载一个文件
b)你不能在你的本地机器上更新文件
是吗?
我自己发现了这个问题。
原文:
bGetFile = m_pFtpConnection-> GetFile(_T(Server.ini), _T(.// Download.ini),false);
更改为:
bGetFile = m_pFtpConnection-> GetFile(_T(RemoteSetting // Server。 ini)
,_T(。// Se rver.ini)
,false
,FILE_ATTRIBUTE_NORMAL
,FTP_TRANSFER_TYPE_BINARY | INTERNET_FLAG_RELOAD
);
它可以从服务器下载最新文件:)
Hello everyone!
I used the CFtpConnection::GetFile to download the file from server,
but I found a odd question.
The downloaded file can't update.
It means the file I downloaded wouldn't be latest if the file of server has updated.
main code:
CInternetSession *InternetSession;
CFtpConnection *m_pFtpConnection;
void CFTP_testDlg::OnBnClickedButtonConnect()
{
CString sServerIP, sUser, sPassword;
sServerIP=_T("192.168.7.123");
sUser=_T("kobe2");
sPassword=_T("kobe2");
InternetSession = new CInternetSession(_T("My Ftp Session"));
m_pFtpConnection =
InternetSession->GetFtpConnection(sServerIP,sUser,sPassword,21,true);
//Passive FTP
}
void CFTP_testDlg::OnBnClickedButtonGetFile()
{
bool bGetFile=false;
bGetFile=m_pFtpConnection- >GetFile(_T("RemoteSetting//Server.ini"),_T(".//Server.ini"),false);
if(bGetFile)
MessageBox(_T("Download Succeed!"),_T("Info"), MB_OK | MB_ICONINFORMATION );
else
MessageBox(_T("Download Fail!"),_T("Info"), MB_OK | MB_ICONINFORMATION );
}
I'm so appreciated if somebody could give me a suggestion.
Thanks a lot!!
not exactely sure what you mean by
Quote:The downloaded file can't update.
It means the file I downloaded wouldn't be latest if the file of server has updated.
can you please try and re-phrase what the issue is .. I see
a) you can download a file
b) you cant update the file on your local machine
is that it ?
I found the question by myself.
original:
bGetFile=m_pFtpConnection->GetFile(_T("Server.ini"),_T(".//Download.ini"),false);
change to:
bGetFile=m_pFtpConnection->GetFile(_T("RemoteSetting//Server.ini")
,_T(".//Server.ini")
,false
,FILE_ATTRIBUTE_NORMAL
,FTP_TRANSFER_TYPE_BINARY|INTERNET_FLAG_RELOAD
);
It can download the latest file from server:)
这篇关于[MFC] FTP的GetFile()无法更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!