Home Forums ActiveX components Xceed FTP for ActiveX Error during file send: The remote file could not be opened

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #42663 |

    When i run the sample “MethodDemo” with “-send” arguments, the error appeard.
    I don’t known why, so post a message!! Please help me!! Thank you very much !!

    Imported from legacy forums. Posted by EricSheng (had 7649 views)

    User (Old forums)
    Member
    Post count: 23064

    When i run it, it show me the error string!! and it create a directory on server at one time!!

    for example:

    MethodDemo.exe -send c:\bb.txt \

    It will create a directory named “bb.txt” !!

    Why??

    Thank you !!

    Imported from legacy forums. Posted by EricSheng (had 511 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Eric.

    There is a minor bug in this sample, when trying to send a file to the root folder, or when you provide a destination folder name that ends with a backslash or a forward slash. It’s not a bug with the produt.

    In the sample’s <b>Send</b> function, modify the following line:

    <code>
    wsprintf( szRemoteFilename, “%s\\%s”, pszRemoteFolder, szFilename );</code>

    With the following code:

    <code>
    int nRemoteLen = lstrlen( pszRemoteFolder );

    if( ( nRemoteLen == 0 )
    || ( ( pszRemoteFolder[ nRemoteLen-1 ] != ‘\\’ )
    && ( pszRemoteFolder[ nRemoteLen-1 ] != ‘/’ ) ) )
    {
    wsprintf( szRemoteFilename, “%s\\%s”, pszRemoteFolder, szFilename );
    }
    else
    {
    wsprintf( szRemoteFilename, “%s%s”, pszRemoteFolder, szFilename );
    }</code>

    To be honest, I did not fully tested this fix yet, but you get the idea! 😀

    Imported from legacy forums. Posted by Martin (had 363 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Martin.
    Thank you very much for your help!!
    I replaced your code! and it also show this message! It does not work well when i send a file to root folder sometime.
    but it works well when i send a file to one sub folder.

    for example :
    obj->SendFile( “c:\aa.txt”, 0, “\aa.txt”, FALSE ); // sometimes it doesn’t work
    but
    obj->SendFile( “c:\aa.txt”, 0, “\bb\aa.txt”, FALSE ); // bb is a sub folder, it works well

    Imported from legacy forums. Posted by EricSheng (had 560 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Eric.

    Some FTP servers do not use the “/” or “\” character as a folder separator. If you want to send a file to the original folder you’re in right after you connect, you can use a filename without a leading slash or backslash, like this:

    <code>obj->SendFile( “c:\aa.txt”, 0, “aa.txt”, FALSE );</code>

    If you still get more problems with the SendFile method and folder names, I suggest you send an email to <mail>support@xceedsoft.com</mail>, including the problematic code, a log file (see CommandLogFilename property), and if possible the server address, username and password.

    Imported from legacy forums. Posted by Martin (had 312 views)

    User (Old forums)
    Member
    Post count: 23064

    HI Martin.

    Thank you very much!

    It works well today! Thank you!

    Imported from legacy forums. Posted by EricSheng (had 572 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Martin.

    Thank you very much for your help!
    It works well today, thank you!

    Imported from legacy forums. Posted by EricSheng (had 6465 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.