Android Question Transfer image by FTP with problem

Alisson

Active Member
Licensed User
I try send one image to FTP. I use the code:

B4X:
Sub btninvio_Click
    ftp1.Initialize("ftp1","ftp.address.com","21","username","password")
    ftp1.UploadFile(File.DirRootExternal,"photo.jpg",True,"photo.jpg")
    ftp1.Close 
End Sub

The image is send to FTP, but the image lost the pixels, not display pixels.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Remove the ftp1.close at this place, wait for the upload finish event get raised and then close the connection
 
Upvote 0

rscheel

Well-Known Member
Licensed User
Longtime User
@Alisson
True change for False in this line

B4X:
ftp1.UploadFile(File.DirRootExternal,"photo.jpg",False,"photo.jpg")

and delete

B4X:
 ftp1.Close
 
Upvote 0

Alisson

Active Member
Licensed User
I defined the the file zip like image name, but have the application ftp.

Thanks
 

Attachments

  • Image.zip
    7.7 KB · Views: 266
Upvote 0

rscheel

Well-Known Member
Licensed User
Longtime User
I defined the the file zip like image name, but have the application ftp.

Thanks
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim ftp1 As FTP
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
  
    Dim btninvio As Button
    Dim btncarica As Button
    Dim btncancella As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("tutorial")
    ftp1.Initialize("ftp1","FTP_IP","21","USER","PASS")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub btninvio_Click
  
    ftp1.UploadFile(File.DirRootExternal,"photo.jpg",False,"photo.jpg")

End Sub

Sub btncarica_Click
  
End Sub

Sub btncancella_Click
  
End Sub
Sub ftp1_UploadCompleted (ServerPath As String, Success As Boolean)
    If Success = True Then
        Msgbox("","")
      
    End If
End Sub
 
Last edited:
Upvote 0

Alisson

Active Member
Licensed User
Sorry DonManfred !!!
When I tested his suggestion I went to check the result of the transfer , but my server began to reject the connections and give timeout , then can't complete these checks.
This morning I could conclude that your sample work, its ok, perfect!
I thought to answer your questions , beyond the server timeout problem and had was at the end of working hours .
Thanks veru much.
 
Upvote 0
Top