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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.