Android Question upload image from imageview to FTP

appie21

Active Member
Licensed User
Longtime User
Hello

How can i upload a image from a imageview to a ftp server?

I have search the form for it but nothing good found.


i have

FTP.UploadFile(ImageView1.Background, "01.JPG", False, "01.JPG")

but then it give
libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)

How to fix?

B4X:
Sub Process_Globals
    Dim FTP As FTP
End Sub
Sub Globals

    Dim Button1 As Button
    Dim ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
  Activity.LoadLayout ("Layout1")
    If FirstTime Then
        FTP.Initialize("FTP", "ftp.myftp1.com", 21, "user5", "password")
    End If
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub Button1_Up
   
End Sub
Sub Button1_Click
    'FTP.UploadFile(File.DirRootExternal, "1.txt", True, "1.txt")
FTP.UploadFile(ImageView1.Background, "01.JPG", False, "01.JPG")
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
 
Top