Android Question FTP download of Graphic files with NET library error

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to All
I implemented a download sub for getting png/jpg files from a server to a tablet. Things apparently work, but actually the files are corrupted. I suspect a problem of encoding (something related to Base64) in transmitting the files. Any hint? Thanks in advance.

The working code used is the following (don't look to details like FileName, or dir etc.: it works; the problem is not there):

B4X:
Private Sub TileDownload(Fname As String) As ResumableSub
    Dim res As Boolean
    Dim dir As String
    Dim p As Int

    p=Fname.LastIndexOf("/") ' Fname enters as complete Path address. FileName just the last part
    dir=Starter.rp.GetSafeDirDefaultExternal(WorkDirectory)
 
   Dim sf As Object = ftp.DownloadFile(Fname, True,dir , Fname.SubString(p+1))
    
    res=False
    
    Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean)
    
    Sleep(100)
    
    If Success Then
        'Log(Fname & " was downloaded successfully")      
       res=True
    Else
        'Log("Error downloading file")
    End If
    Return res
End Sub
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. I have found my mistake: the second parameter in ftp.Download must be "false", because the files are obviously not Ascii. That's all.
 
Upvote 1
Top