Italian [B4A] FTP upload non "uploadda"

Aldo's

Active Member
Licensed User
Ho scritto questo codice:
B4X:
    Dim sCodice As String
    Dim sIns As String
    SQL1.Initialize(DBDirName,DBFileName,False)
    ResultSet1=SQL1.ExecQuery("SELECT * FROM Impostazioni")
    Do While ResultSet1.NextRow
        sCodice=ResultSet1.GetString("codice_utente").Trim & ".db"
        sIns=ResultSet1.GetString("mail_insegnante").trim
    Loop
    SQL1.Close
    File.Copy(DBDirName,DBFileName,DBDirName,sCodice)
    Dim sDir As String = "/apmobi"
    Dim sFile As String = "/" & sIns & "/" & sCodice   
    ftp.Initialize("ftp", sServer, 21, sUserId, sPassword)
    ftp.PassiveMode = True
    Dim sf As Object = ftp.UploadFile(DBDirName, sFile, False, sDir)
    Wait For (sf) ftp_UploadCompleted (ServerPath As String, success As Boolean)
    If success Then
        Log("file was uploaded successfully")
    Else
        Log("Error uploading file")
    End If

Mi restituisce "Error uploading file"

I dati che passo sono giusti...
...cosa cavolo sbaglio?
Grazie

PS: scusate per il titolo del thread
 

Aldo's

Active Member
Licensed User
Ho aggiunto questa riga:
B4X:
        Log(LastException.Message)
e ho ricevuto questo messaggio:
android.system.ErrnoException: open failed: ENOENT (No such file or directory)
 

Aldo's

Active Member
Licensed User
Ho risolto, in sDir dovevo mettere anche il nome del file.
Mi sorge un altro dubbio...
...posso creare una directory specifica sul server ftp da codice?
 

moore_it

Well-Known Member
Licensed User
Longtime User
Si utilizzando i comandi FTP
B4X:
Dim sf As Object = DefsFtp.SendCommand("MKD","/UPLOADS")
                    wait for (sf) FTP_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…