CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 1999
    Posts
    15

    Need help on CFTPConnection....Urgent

    Hi Folks,
    I am new to VC++ ...
    I am using CFTPConnection, CInternetSession for doing the ftp. How can I get a file from remote server to a particular directory on local machine ?
    There are functions to change the remote directory but nothing to change local directory ...Are there any functions like SetDirectory for changing local path !
    I tried
    Cstring LocalFile = "C:\\windows\\test1.dat"
    RetVal = FTPConnection->GetFile(LocalFile,FileName,FALSE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_ASCII,1);

    Doesn't work !!!

    I need urgent help !!!


  2. #2
    Join Date
    Jul 1999
    Posts
    3

    Re: Need help on CFTPConnection....Urgent

    A sample:
    CString strDirRemote="/temp",
    strNomeArq = "exemplo.txt",
    strDirLocal = "c:/windows/temp";
    BOOL bResult = m_FtpConnection->SetCurrentDirectory ( strDirRemote);
    if ( bResult )
    {
    CString strArquivoOrigem, strArquivoDestino;
    BOOL bFailIfExists = FALSE;
    strArquivoOrigem = strDirRemote;
    strArquivoOrigem += "/";
    strArquivoOrigem += strNomeArq ;
    strArquivoDestino = strDirLocal;
    strArquivoDestino += "/";
    strArquivoDestino += strNomeArq;
    DWORD dwFlagFtpTransferType;
    dwFlagFtpTransferType =FTP_TRANSFER_TYPE_ASCII;
    dwFlagFtpTransferType |=INTERNET_FLAG_RELOAD;
    m_FtpConnection->GetFile ( strArquivoOrigem, strArquivoDestino,bFailIfExists, FILE_ATTRIBUTE_NORMAL, dwFlagFtpTransferType);
    }

    Hope this helps,

    Leila


  3. #3
    Join Date
    Apr 1999
    Location
    Philadelphia, PA, US
    Posts
    138

    Re: Need help on CFTPConnection....Urgent

    this sample does not work. Any idea ??
    Here is my code and it does not work too. Any body help .....

    I am connected to ftp b.c iu can set current directory. userID and passwords are correct ..

    =========================
    CFtpConnection* ftp;
    ftp = session.GetFtpConnection( g_strServerName , szUser, szPassword, (INTERNET_PORT) g_nPort);
    ftp->SetCurrentDirectory("/kruse") ;

    ftp->GetFile("/kruse/abc.txt", "c:/windows/temp/qick.txt", FALSE, FILE_ATTRIBUTE_NORMAL, 1 ) ;

    if ( ftp->PutFile("C:/Mahesh.txt", "/Kruse/Mahesh.txt", FTP_TRANSFER_TYPE_ASCII, 1 ) != 0 )
    AfxMessageBox("success");





  4. #4
    Join Date
    Sep 1999
    Location
    Dubai, United Arab Emirates
    Posts
    9

    Re: Need help on CFTPConnection....Urgent

    Try changing the statement below from

    RetVal = FTPConnection->GetFile(LocalFile,FileName,FALSE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_ASCII,1);




    to


    RetVal = FTPConnection->GetFile(FileName,LocalFile,FALSE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_ASCII,1);








Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured