ct=ftpconn->PutFile("c:/dd1.txt","ee.txt",FTP_TRANSFER_TYPE_ASCII);
我用这个上传文件为什么不好使呢,在这之前已经连接到FTP上,但上传文件就不好使,返回值总是false

解决方案 »

  1.   

    GetLastError()先看看到底是什么错误。
      

  2.   

    Res
    PutFile is a high-level routine that handles all of the operations associated with storing a file on an FTP server. Applications that only send data, or that require closer control over the file transfer, should use OpenFile and CInternetFile::Write.Override the dwContext default to set the context identifier to a value of your choosing. The context identifier is associated with this specific operation of the CFtpConnection object created by its CInternetSession object. The value is returned to CInternetSession::OnStatusCallback to provide status on the operation with which it is identified. See the article Internet First Steps: WinInet for more information about the context identifier.
      

  3.   

    我用的是这种方法,
    FormatMessage( 
        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
        FORMAT_MESSAGE_FROM_SYSTEM | 
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        GetLastError(),
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
        (LPTSTR) &lpMsgBuf,
        0,
        NULL 
    );MessageBox((LPCTSTR)lpMsgBuf, "Error", MB_OK|MB_ICONINFORMATION);
    LocalFree( lpMsgBuf );
    没有错误呀,
      

  4.   

    ct=ftpconn->PutFile("c:/dd1.txt","ee.txt",FTP_TRANSFER_TYPE_ASCII);"c:\\dd1.txt" ???
      

  5.   

    ct=ftpconn->PutFile("c:\\dd1.txt","ee.txt",FTP_TRANSFER_TYPE_ASCII);