This works great! However, I plan to download multiple files. In a effort to minimize unnecessary code, is the SubJobDone required for each download. Or is there a way to download several files in one procedure?
Also, it works but...what is the "j"?
Sub Button1_Click
Dim Job As HttpJob
Job.Initialize("j", Me)
Job.Download("http://www.myUrl.com/myFile.txt")
End Sub
Sub JobDone(job As HttpJob)
If job.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "myFile.txt", False)
File.Copy2(job.GetInputStream, out)
out.Close '<------ very important
ToastMessageShow("File Downloaded Sucessfully!", True)
Else
Log("Error: " & job.ErrorMessage)
End If
job.Release
End Sub
Also, it works but...what is the "j"?
Sub Button1_Click
Dim Job As HttpJob
Job.Initialize("j", Me)
Job.Download("http://www.myUrl.com/myFile.txt")
End Sub
Sub JobDone(job As HttpJob)
If job.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "myFile.txt", False)
File.Copy2(job.GetInputStream, out)
out.Close '<------ very important
ToastMessageShow("File Downloaded Sucessfully!", True)
Else
Log("Error: " & job.ErrorMessage)
End If
job.Release
End Sub