Sub UploadTimer_Tick
Dim fileList As List
Dim n As Int
Dim file1 As String
fileList = File.ListFiles(File.DirRootExternal & "/Download/ubtxt/Files/")
fileList.Sort(True)
lblfilesinque.Text = fileList.Size
If fileList.Size > 0 Then
' Loop through the list. upload the first file in the queue and exit loop
For n = 0 To fileList.Size-1
file1 = fileList.Get (n)
FileJob = file1
Dim job2 As HttpJob
job2.Initialize(FileJob,Me)
job2.PostFile("http://www.xxxxxxxx.com/uploadimg.php?filename=" & fileList.Get(0),File.DirRootExternal & "/download/ubtxt/Files/", file1)
Exit ' Exit for loop after processing the first file
Next
End If
End Sub
Sub JobDone (Job As HttpJob)
Dim Filename As String
If Job.Success = True Then
Select Job.JobName
Case "Job1"
'Get and set the device status
DevStatus(Job.GetString)
Case FileJob
Filename = Job.GetString
Filename = Filename.Trim
File.Delete (File.DirRootExternal & "/Download/ubtxt/Files/",Filename)
ToastMessageShow("Upload Ok: " & Filename ,False)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub