Android Question FTP.upload

yeroen

Member
Licensed User
Longtime User
Hey,
i use b4a version 5.80.
In my app should I upload current data (football scores) via FTP.
(This is after a cheat code because the user can not do this.)
But I get no way access.
(Now I need to upload the data via a circuitous way.)
It's all right here for a free host: Hostfree.nl.
I have already asked there but get no answer.
Maybe I should not expect much of this free service.
But I want to be sure I made no coding errors.
(See: attached code.)
Does anyone have any tips?
(By the way: Download via HTTP lib is ok. The ----- is ofcourse for privacy.)

Anyway if you want to download this wonderful app (lol)
It concerns the European Football Championship 2016 in France.
See:
https://play.google.com/store/apps/details?id=ec2016.b4a&hl=nl
Jeroen van Baaren, Haarlem, Holland

Already tried: FTP passive and active mode.
Here is some code about the FTP lib:

Sub SetProcessGlobals
sURLdownload = "http://yeroen1954.hostfree.nl/i------6/maTemp.txt"
sURLupload = "/home/u-------3/public_html/public_html/maTemp.txt"
End Sub

Sub ButtonUpload_Click 'Only used if bCheat=True ! (fill in football score: 3-------9)
Dim FTP As FTP
FTP.Initialize("FTP", "FTP.yeroen1954.hostfree.nl", 21, "u------3", "f-------4")
FTP.UploadFile(Main.sDir,"maTemp.txt", True, sURLupload)
FTP.Close

' Msgbox("does not work yet...","")

End Sub

Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long) 'Only used if bCheat=True !
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 If
End Sub

Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean) 'Only used if bCheat=True !
Log(ServerPath & ", Success=" & Success)
If Success = False Then
Log(LastException.Message)
Msgbox(LastException.Message,"")
Else
Msgbox("FTP upload ready","")
End If
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Please use code tags when posting code!
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
sURLupload = "/home/u-------3/public_html/public_html/maTemp.txt"

Which start-Folder did you assign to the ftp-user? Maybe you double the path which causes "no access"? Just try it with a simple folder like "test" (not that long path in sURLupload for a quick test). See the comment in the following code.

B4X:
ServerFTPAddress="MyFTPServer"
    ServerFTPUser="MyFTPUser"
    ServerFTPPw="MyFTPUserPw"
  
    ServerFTPPath="xxxxx/" ' note: simple directory UNDER the FTP path where you get to when you login with the user. Example: After login you are in "MyServer/somefolder" so with "xxxxx/" you store it in "MyServer/somefolder/xxxxx/"
 
Upvote 0
Top