B4J Question download file code with Jokhttputils2

alas

Member
hello

i have an app to download files from internet here the code


[CODE lang="b4x" title="download file"]Sub startdownload(filename1 As String)

Private j As HttpJob
'--------------------------------------------------------------- start the process of download
getfilename' get the file name before saving
'--------------------------------------------------------'load progress dialog
ShowDialog

'---------------------------------------------------------
j.Initialize("", Me)
'HttpUtils2Service.acceptallsslcertificate
j.Download(filename1)
Wait For (FindTaskId(j)) Complete (TaskId As Int)
'Wait For (j) JobDone(j As HttpJob)
Dim b() As Boolean = Array As Boolean(False)
TrackProgress(j, b, TaskId)
' j.Release
Wait For (j) JobDone (j As HttpJob)
b(0) = True

If j.Success Then
Label1.Text = Label1.Text
ProgressBar1.Progress = 1
If ProgressBar1.Progress=1 Then
dialog.Close(xui.DialogResponse_Cancel)
End If
Dim out As OutputStream = File.OpenOutput(File.DirApp, filename , False)
File.Copy2(j.GetInputStream, out)
out.Close
Log("success")
fx.ShowExternalDocument(File.GetUri(File.Dirapp, ""))'open download folder

End If

j.Release
'Return j.Success
''''''''''''''''''''''''''''''''''''''''' end of download file

End Sub[/CODE]

but i am getting this message

[CODE lang="b4x" title="Log"]ResponseError. Reason: , Response: OFLINE: 195.201.87.181 OFLINE: 195.201.87.181 OFLINE: 195.201.87.181 OFLINE: 195.201.87.181 OFLINE: 195.201.87.181 [/CODE]

please advise
 
Back
Top