NagendranathBolledhula-9670 avatar image
0 Votes"
NagendranathBolledhula-9670 asked MinxinYu-MSFT edited

File name is not returned properly from the FTP server

On a FTP server the file is present as below

ftp> dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-rw-r-- 1 user1 domain users 17787 May 10 15:14 202205101514.csv

I am using CInternetConnection class to get the FTP connection and to find the file using class CFtpFileFind but the file is returned as "177787 May 10 15.csv" instead of "202205101514.csv".
Somehow the program is returning the "Filesize+Month+Date" as file name instead of the actual title. The same code is working on a different FTP server.
So, somehow I feel there is an issue with the FTP server but don't have an evidence to prove? . Any help is much appreciated

Sample code:-

CFtpConnection *pftpConnection = NULL;
CInternetConnection *pInetConnection = NULL;


pftpConnection = pInetSession.GetFtpConnection((LPCTSTR)SITEINF.IPadd, (LPCTSTR)SITEINF.UserName, (LPCTSTR)SITEINF.password, SITEINF.port, TRUE);

CFtpFileFind *m_pFileFind = new CFtpFileFind(pftpConnection);
BOOL bwrking = m_pFileFind->FindFile(Path);
CString strFileName = m_pFileFind->GetFileName();

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Did the phenomenon occur only on the certain machine?
For your reference: CFileFind::GetFileName

You must call FindNextFile at least once before calling GetFileName.

0 Votes 0 ·

0 Answers