Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
Dim s As String
s = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
TotalDownloaded is the number of bytes currently downloaded.
Total is the file size. If you use Passive Mode, you get always -1.
You should set Passive Mode to False or you can get the file size using the FTP command List:
B4X:
FTP.List(mFTPServerUserFolder)
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
If Success Then
For Each f As FTPEntry In Files
Log(f.Name & ": " & NumberFormat2(f.Size, 1, 0, 0, True) & " Bytes")
Next
Else
Log(LastException.Message)
End If
End Sub