Dato questo esempio nel
tutorial di Erel:
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 è il numero di byte scaricati attualmente
Total è il numero totale di byte da scaricare, ovvero le dimensioni del file da scaricare. Se è -1 significa che, per qualche motivo che per il momento *
non conosco, questo dato non è disponibile.
* P.S.
Pere che il pompelmo faccia mele...
no, volevo dire, PARE che quel dato, chiamato ContentLength, non venga fornito se viene impostato il modo passivo.
Se si vuole continuare col modo passivo, l'unica soluzione è ricavare la lunghezza del file tramite il comando FTP List:
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