Hi, I need some assistance. with downloading files from web site.
with httpjob.
I have this code for downloading files
and log downloaded files but where are the files ??
I have 2 days working with this mode, this is good aproche to do this?
Victor
with httpjob.
I have this code for downloading files
B4X:
dim playlistx as list
playlistx.Initialize
Dim url_location As String = "http://10.0.0.32/uploads/"
playlistx.Add( "free_1.jpg")
playlistx.Add( "free_2.jpg")
playlistx.Add( "free_3.jpg")
playlistx.Add( "free_4.jpg")
For i = 0 To playlistx.Size - 1
dd.Initialize(playlistx.Get(i), Me)
file_name = playlistx.Get(i)
Try
dd.Download(url_location & file_name)
Log("Download Filename : " & url_location & file_name)
Catch
Log(LastException)
End Try
Next
and log downloaded files but where are the files ??
B4X:
Sub JobDone(Job As HttpJob)
If Job.Success Then
Log("Succes Downloading file")
Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal ,file_name,False)
Log("Filename : " & file_name)
File.Copy2(Job.GetInputStream, Out)
Out.Close
Job.Release
bm.Initialize(File.DirRootExternal ,file_name)
blist.Add(bm)
Log("belist size : " & blist.Size )
Else
Log("Error downloading image: " & Job.JobName & CRLF & Job.ErrorMessage)
End If
End Sub
I have 2 days working with this mode, this is good aproche to do this?
Victor