views:

52

answers:

0

hi ,

I have implemented FTP, for downloading i am using FTPGetFile but is throwing error "Error 87 : The Parameter is incorrect"

My code looks like :

int CFtpClient::GetFile(char* szRemoteFile, char* szLocalFile,int iType, DWORD& dwLastError )
{
    dwLastError = 0;

    if (m_bActiveSession)
    {
        if (!FtpGetFile (m_hConnect,szRemoteFile, szLocalFile,false,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY | INTERNET_FLAG_RELOAD,0 ) )
        {
            //cout << "Error GET" <<endl;
            string test = GetLastErrorMessage(GetLastError());
            dwLastError = GetLastError();
            return ERR_GET;
        }   
    }
    else
    {
        //cout << "No active session" ;
        return ERR_NOSESSION;

    }
    AfxMessageBox("Downloaded Successfully"); 
    return ERR_NONE;

}

I am calling it like :

int downloadret = ftpclient.GetFile("test.pdf","D:\\test.pdf",0,dwLastError);

Any idea ?