CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Uploading a File to the FTP

    Hi Everybody
    I was having trouble and wondering if anybody could give me a short example of how to

  2. #2

    Re: Uploading a File to the FTP

    try this.

    m_pInetSession = new CInternetSession( NULL, 1, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    try
    {
    m_pFTPConnection= m_pInetSession->GetFtpConnection( (LPCTSTR)m_ftpHost_address, (LPCTSTR)m_ftpHost_username, (LPCTSTR)m_ftpHost_password, m_export_port, FALSE );
    m_pFTPConnection->SetCurrentDirectory((LPCTSTR)newFtpDir);
    }
    catch (CInternetException* pEx)
    {
    // catch errors from WinINet
    TCHAR szErr[1024];
    if (pEx->GetErrorMessage(szErr, 1024))
    AfxMessageBox(szErr, MB_OK);
    else
    {
    strcpy(szErr,"FTP connection error");
    AfxMessageBox(szErr, MB_OK);
    }
    pEx->Delete();
    }

    int success = m_pFTPConnection->PutFile( (LPCTSTR)filepath,(LPCTSTR)outfile,FTP_TRANSFER_TYPE_BINARY,1); // Open File on server

    Steve White


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