I have a FTP class I am working on and have the sub listed below. At the end of the upload I get an invalid index error. I am passing the list to the class sub and the message box shows the same size for both. Yet the uploadprogress gives the index error before the size shown in the message box below is reached. I think it has something to do with Files_List2. It is declared in Class_Globals as Private. Private Files_List2 As List. The sub in this class is called from the main Activity with:
It's like it's working on a copy of the Files_List2 in the uploadset sub and the uploadprogress sub is using the one defined in Class_Globals. Any ideas?
B4X:
'In main Activity
Sub V_Click
Dim uplist As List
uplist.Initialize
uplist = File.listfiles(File.DirInternal)
FTP.FTP_UpLoadSet(File.DirInternal, uplist, "test/files")
End Sub
B4X:
'Sub in FTP Class Module
Sub FTP_UpLoadSet(LocalPath As String, UpLoadList As List, ServerPath As String)
Files_List2.Initialize
Files_List2 = UpLoadList
Msgbox(UpLoadList.Size, Files_List2.Size) 'This line shows they are the same
SingleUp = False
If Files_List2.Size > 0 Then
UpLoadComplete = False
aSet = 0
LP = LocalPath
GF = Files_List2.Get(aSet)
FP = ServerPath & iif(Right(ServerPath, 1) = "/", "", "/")
FTP.UploadFile(LP, GF, False, FP & GF)
Else
SingleUp = True
Msgbox("No Files Found...", "")
End If
End Sub
It's like it's working on a copy of the Files_List2 in the uploadset sub and the uploadprogress sub is using the one defined in Class_Globals. Any ideas?
Last edited: