Hi,
I am using below code by Erel to calculate size of remote file and then downloading it thru FTP.(Because FTP doesnt provide Total File Size in Total Parameter)
but the execution doesn't wait for job to finish it continues to next line which starts FTP download.
Can anyone pls give a clue what is missing here.
Thanks
Juzer
I am using below code by Erel to calculate size of remote file and then downloading it thru FTP.(Because FTP doesnt provide Total File Size in Total Parameter)
B4X:
Sub PF_FileSize(sFileName As String)
Dim j As HttpJob
Dim sPath As String
Dim result As String=""
sPath="http://xyz.in/App/Profile/" & sFileName
If FileMap.IsInitialized=False Then
FileMap.Initialize
End If
j.Initialize("", Me)
j.Head(sPath)
Wait For (j) complete (j As HttpJob)
If j.Success Then
Dim length As List = j.Response.GetHeaders.GetDefault("content-length", Null)
If length.IsInitialized Then
result=length.Get(0)
FileMap.put(sFileName: Result)
End If
End If
End Sub
but the execution doesn't wait for job to finish it continues to next line which starts FTP download.
Can anyone pls give a clue what is missing here.
Thanks
Juzer