Android Question Upload image and PDF files

mariosteffen

Member
Licensed User
Longtime User
I need to upload jpg and PDF files using FTP. I am using B4A version 13.10, Net Library and the telephone has Android V14.
The code is attached and it works with TXT files, but does not work with JPG, PNG, BMP and PDF.
To upload TXT I tested Ascii = True and Ascii = False and both work fine.
Does anybody have an idea what am I doing wrong?
I do not have any error messages also. The program stops withtout any kind of message.
I tried to upload images and PDF with Ascii = True and Ascii = False, but none of them work.
If I use Filezilla to upload to the sasme server, all the files upload normally.
Other PDF commands, like LIST, MKD, and DOWNLOAD work fine.

Thanks.


Upload code:
    FTP.Initialize("FTP","www.xxxx.com.brr",21,"xxx","xxxx")
    FTP.PassiveMode=True
    Try
        Dim sf As Object = FTP.UploadFile(File.DirRootExternal, "/Documents/aw.png", False, "/aw.png")
        Wait For (sf) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
    Catch
        Log(LastException)
    End Try
   
Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
    Dim s As String
    s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
    If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
    Log(s)
End Sub

Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
    Log(ServerPath & ", Success=" & Success)
    If Success = False Then Log(LastException.Message)
End Sub
 

teddybear

Well-Known Member
Licensed User
Last edited:
Upvote 0
Top