Android Question Weird FTP results

morphe2011

Member
Licensed User
Longtime User
Hello All
I've got 10 photos taken on a device. The photos are on the device's hard drive and all in the same location. All are valid photos visible on the device and all are the same size and quality. I've been using the latest Net (1.53). The files are sent sequentially to a path on the FTP that is accessible. _UploadCompleted fires for all 10 and all supposedly arrive without error and yet at the FTP end the results are totally random. Anywhere from 6 to all 10 arrive. Each time they are uploaded they go into a separate, clean folder.

FTP is set up as
AllFTP.UseSSL=False
AllFTP.UseSSLExplicit=False
AllFTP.PassiveMode=True
AllFTP.Initialize("FTPD",gsFTPIP,21, "dogwood", gsFTPPassword)
AllFTP is Dim AllFTP As FTP
The Upload is AllFTP.UploadFile(sDBPath,sPic,True,"/sitechecker/" & sPic) and the UploadedComplete is :
Sub FTPD_UploadCompleted(ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then
Log(LastException.Message)
Msgbox("Error uploading " & ServerPath,"SiteChecker")
Else
Log("File Uploaded")
'File.Delete(sDBPath,ServerPath.SubString(13))
fiNumUp=fiNumUp +1
If fiNumUp>=fiFilesUp Then
Msgbox("All files have been uploaded","Site Checker")
End If
End If
End Sub

I've been using this routine in other apps for at least 6 months without issue but none have moved more than 3 files at a time. I've been scratching my head on this for a week before reaching out. Any suggestions would be most appreciated.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

Try to send the files one after another. It will not be slower as FTP can only handle a single file at a time anyway.

Put all the file names in a global List. Download the first one. In UploadCompleted remove the first item from the list and download the first item in the list. That is until the list is empty.
 
Upvote 0
Top