B4J Question FTP UploadFile problem

Discussion in 'B4J Questions' started by imbault, Jul 13, 2015.

  1. imbault

    imbault Well-Known Member Licensed User

    Hi,
    Using FTP object, I've got a error
    While, the same credentials and passive mode on FileZilla uploads like a charm,

    Here is the code (simple)
    Code:
    cFile1="BAQ_liste_analyses_L14_S107_150710_112605.csv"
        
    LogFile.Exists(File.DirApp,cFile1))
        oFTP.Initialize(
    "FTP", FTP_Server, 21, FTP_User, FTP_Password)
        oFTP.PassiveMode = 
    True
        oFTP.UploadFile(
    File.DirApp, cFile1, True"/"  )
    Does anyone has an idea???
    B4J V3.00
    jNet Lib V 1.10
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Recheck the user name, password and port. It is also possible that FileZilla uses a different protocol (SFTP for example).
     
  3. imbault

    imbault Well-Known Member Licensed User

    Thanks Erel, the problem was elsewhere as usual so, I post it, because it could help someone else:
    FTP.UploadFile last parameter is ServerFilePath - Full path to file that will be created on the server.
    In that case ServerFilePath must contain also the file created on the FTP target site

    So working code (is that case) is:

    Code:
    cFile1="BAQ_liste_analyses_L14_S107_150710_112605.csv"
        
    LogFile.Exists(File.DirApp,cFile1))
        oFTP.Initialize(
    "FTP", FTP_Server, 21, FTP_User, FTP_Password)
        oFTP.PassiveMode = 
    True
        oFTP.UploadFile(
    File.DirApp, cFile1, True"/" & cFile1  )
     
Loading...