Android Question Help With FTP

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I am using "Net" version 1.62, to upload a file to an FTP server
  • App generates a comma delimited file and saves it with a fixed name( for example abc.csv)
  • The file gets saved in DirRootExternal

if I use the following code to upload to my FTP server. The status returns success = true, but I keep finding the first/original file uploaded to the ftp server. I deleted the file manually from the server and I tried many times, I keep getting the same results

B4X:
Public Sub TF_FTPUpload(FileFolder As String, FileName As String, blnASCIIFile As Boolean, ServerFolder As String )
 
      Dim ServerFile As String = File.Combine( ServerFolder, FileName )
    FTP1.UploadFile(FileFolder, FileName, blnASCIIFile, ServerFile )
 
End Sub


Simply changing the above code to the code below, the problem disappears

B4X:
Public Sub TF_FTPUpload(FileFolder As String, FileName As String, blnASCIIFile As Boolean, ServerFolder As String )
 
    Dim ServerFile As String = File.Combine( ServerFolder, DateTime.Now & "_" & FileName )
    FTP1.UploadFile(FileFolder, FileName, blnASCIIFile, ServerFile )
End Sub

Basically using a new file name for the server copy, solves the issue
 
Top