Android Question Does not upload the image to the server via FTP

I'm trying to upload a picture to the server via FTP but it gives an error: 550 ftp.tools/home/xe528416/logo.png: No such file or directory

FTP Upload:
Private Sub bt_ftp_Click
    
    Dim FTP As FTP
    
    If File.Exists (File.DirInternal,"a2.png")=False Then
        File.Copy(File.DirAssets,"a2.png",File.DirInternal,"a2.png")
    End If

    FTP.Initialize("FTP", "xe528416.ftp.tools", 21, "xe528416_man", "Ga251udr24")
    
    FTP.UseSSL = False
    FTP.PassiveMode = True
    
    
    FTP.AppendFile(File.DirInternal,"a2.png",True,"/home/xe528416/a2.png")
    
    FTP.Close
    
End Sub

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

LOG.jpg



Please tell me where I went wrong? I tried different options for the folder address. but nothing was sent to the server
 

JohnC

Expert
Licensed User
Longtime User
The problems could be:

1) The ftp username/password you are using could be configured at the server to place you in a different directory than what you need - meaning, from the directory that the FTP drops you in, it can not access the filepath of "/home/xe528416/a2.png.
2) Does the file "a2.png" actually already exist?
3) Regardless of the error, I would try setting "AsciiFile" parameter in the FTP.Append to "False" because the file appears to be binary and not ascii.
 
Last edited:
Upvote 0
p1.jpg


"xe528416_man", "Ga481udr54"



p2.jpg


Извините, у меня мало опыта. Возможно, причина проста. Пробую разные адреса и имена, но не получается
 
Upvote 0
I tried to get a list of files like in the tutorial.
FTP Upload:
Dim FTP As FTP
    
    If File.Exists (File.DirInternal,"a2.png")=False Then
        File.Copy(File.DirAssets,"a2.png",File.DirInternal,"a2.png")
    End If

    FTP.Initialize("FTP", "xe528416.ftp.tools", 21, "xe528416_man", "Ga481udr54")
    
    FTP.UseSSL = False
    FTP.PassiveMode = True
    'FTP.DownloadFile("ftp.tools/home/xe528416/logo.png", False, File.DirRootExternal, "logo.png")
    
'    Dim sf As Object = FTP.AppendFile(File.DirInternal,"a2.png",False,"home/xe528416/a2.png")
'   
'    Wait For (sf) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
'    If Success Then
'        Log("file was uploaded successfully")
'    Else
'        Log("Error uploading file")
'    End If
    
    FTP.List("/")
    
    FTP.Close


I got the list
p3.jpg
 
Upvote 0
Eureka! I was able to upload the file!


does not work:
FTP Upload:
FTP.AppendFile(File.DirInternal,"a2.png",True,"/home/xe528416/a2.png")

That's how it works:
FTP Upload:
Dim sf As Object = FTP.AppendFile(File.DirInternal,"a2.png",False,"/a2.png")

Thank you all so much for your help!
 
Upvote 0
Top