Sub Class_Globals
Dim pgBar As JavaObject
Dim P As JavaObject = pgBar
Dim prog As Double
Dim currentFileSize As Int
End Sub
Sub SendFile(FileName As String)
FTP.Initialize("FTP", "server", 21, "user", "password")
FileName= "tmp.txt"
currentFileSize = (File.Size(File.DirApp, FileName))/1000
FTP.UploadFile(File.DirApp,NomeFile, True, FileName)
FTP.Close
End Sub
Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
Dim s As String
prog = Round(TotalUploaded / 1000) /currentFileSize
P.RunMethod("setProgress",Array As Object(prog))
s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
Dim P As JavaObject = pgBar
Dim prog As Double
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
prog = 1
P.RunMethod("setProgress",Array As Object(prog))
End Sub