using FTP-lib

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

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
 

Descartex

Well-Known Member
Licensed User
Longtime User
Hi.
Check you are using Passive Mode. Sometimes those free servers does not allow to use "Active Mode".
B4X:
FTP.PassiveMode=True
Regards.
 

yeroen

Member
Licensed User
Longtime User
Thanks Descartex.
But it still not work. I think the problem is caused by this free server.
 

Descartex

Well-Known Member
Licensed User
Longtime User
If you want to test your code, i can create a test user on my paying host to ensure your code is right.
Feel free to send me a PM and i send you that way the settings.
Regards.
 

yeroen

Member
Licensed User
Longtime User
If you want to test your code, i can create a test user on my paying host to ensure your code is right.
Feel free to send me a PM and i send you that way the settings.
Regards.

Yes, I would like to try.
I do not know what this app will do. If there is really going to make a lot of people use, I foresee problems with this free host.
In that case, I'd like to pay for a good server
But first testing.
Thanks in advance.
 
Top