Hi to All
I need to make a sub to download some files from my site. I am trying to use the Net library, with no success. It may be a syntax error or whatever else. The code is obtained by a new B4A project inserting the Upload example (changing to Download of course) in the Button1_Click. I simply get the unsuccessful log message. The file is located in the folder named Download, at first level in the site (i mean : www.mysite.it\Download\FileToDownload). I don't figure out which is the problem.. Thanks in advance.
I need to make a sub to download some files from my site. I am trying to use the Net library, with no success. It may be a syntax error or whatever else. The code is obtained by a new B4A project inserting the Upload example (changing to Download of course) in the Button1_Click. I simply get the unsuccessful log message. The file is located in the folder named Download, at first level in the site (i mean : www.mysite.it\Download\FileToDownload). I don't figure out which is the problem.. Thanks in advance.
B4X:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
'ftp was previously initialized And its event name was set To ftp:
Dim ftp As FTP
ftp.Initialize("ftp", "www.mysite.it", 21, "[email protected]", "password")
Dim sf As Object = ftp.DownloadFile("PathOnServer\FileName.txt", True, File.DirDefaultExternal, "somefile.txt")
Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log("file was downloaded successfully")
Else
Log("Error downloading file")
End If
End Sub