When I run the code below in release mode, on a real device, only 1 file is uploaded to the server, the "If Success' is never triggered, but when I run it in debug mode all the files of the 36 files are send to the ftp server, I must be missing something.
I use B4A 10.2 and Net library v1.80
I use B4A 10.2 and Net library v1.80
B4X:
Public Sub UploadOrderData(pickerId As String)
Dim pickerSendPath, pickerId, uploadFolder As String
Dim filesToSend, filesSent As List
uploadFolder = Starter.ftpFolder
pickerSendPath = $"/scan_app/${pickerId}/sent/"$
'GET FILES
filesToSend = File.ListFiles(uploadFolder)
If filesToSend.Size = 0 Then
Return
End If
filesSent.Initialize
If ftp.IsInitialized = False Then
ftp.Initialize("FTP", Starter.ftpServer, Starter.ftpPort, Starter.ftpUserName, Starter.FtpPassword)
ftp.PassiveMode = True
End If
ProgressDialogShow2("Bestanden versturen..", False)
Sleep(300)
Log($"FILES : ${filesToSend.Size}"$)
For i = 0 To filesToSend.Size - 1
Log(i)
Log($"FILE NAME : ${filesToSend.Get(i)} - ${pickerSendPath}${filesToSend.Get(i)}"$)
Dim sf As Object = ftp.UploadFile(uploadFolder, filesToSend.Get(i), False, $"${pickerSendPath}${filesToSend.Get(i)}"$)
Wait For (sf) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log($"$Time{DateTime.now}"$)
filesSent.Add(filesToSend.Get(i))
Else
Log(LastException.Message)
End If
Next
ftp.Close
ProgressDialogHide
End Sub