iOS Question FTP uploaded file not accessible on server

mcorbeel

Active Member
Licensed User
Longtime User
I use this code to upload files to a ftp server:
B4X:
Dim ftp As FTP
ftp.Initialize("ftp", sServer, 21, sUser, sPwd)
Dim oFtpJob As Object = ftp.UploadFile(sResourceFolder, sFileName, False, "/" & sFileName)
Wait For (oFtpJob) ftp_UploadCompleted (ServerPath As String, Success As Boolean) 
  
If Success Then
    Log("file was uploaded successfully")
Else
    Log("Error uploading file")
End If
When I upload a file, it gets uploaded, the UploadCompleted event fires successfully, but the file seems to be kept "open" on the server. When on the server I try to open the file its says "A sharing violation occured while accessing the file...". (Yes, I waited long enough) Once I stop debugging in the B4i IDE and the app stops I can open the file. So it seems as the ftp upload keeps the file open?
Btw, I use exactly the same code in the B4A version of the app, and with B4A the issue does not occur. The file can be opened immedeately.
Anyone knows what the reason can be that it does not work correctly with b4i, or how I can troubleshoot this?
 
Last edited:
Top