Android Programming Press on the image to return to the main documentation page.

ABFTP

Written by Alain Bailleul

List of types:

ABFTP

ABFTP


Permissions:

android.permission.INTERNET

Events:

None

Members:


  ABFTPConnect (host As String, port As Int, login As String, pwd As String)

  ABFTPConnected As Boolean [read only]

  ABFTPDeleteFile (targetFolder As String, targetFile As String)

  ABFTPDisconnect

  ABFTPDownload (sourceFolder As String, sourceFile As String, targetFolder As String, targetFile As String)

  ABFTPLastError As String [read only]

  ABFTPListFiles (listFolder As String) As String()

  ABFTPUpload (sourceFolder As String, sourceFile As String, targetFolder As String, targetFile As String)

Members description:

ABFTPConnect (host As String, port As Int, login As String, pwd As String)
Connects with a ftp site
host (String) : ftp site e.g. ftp.mywebsite.com
port (Int) : connection port, usually 21
login (String): user login
pwd (String) : user password
Example:
myFTP.ABFTPConnect(
"ftp.mywebsite.com", 21, "login", "password")
If myFTP.ABFTPConnected = True Then
    Msgbox(
"Connected", "")
Else
    Msgbox(myFTP.ABFTPLastError,
"")
End If
ABFTPConnected As Boolean [read only]
returns if you are connected to the ftp
Example:
If myFTP.ABFTPConnected = True Then
    Msgbox(
"Connected", "")
Else
    Msgbox(myFTP.ABFTPLastError,
"")
End If
ABFTPDeleteFile (targetFolder As String, targetFile As String)
Deletes a file from the ftp site
targetFolder (String): folder on the ftp site starting and ending with /
targetFile (String) : file name
Example:
myftp.ABFTPDeleteFile(
"/upload/","test.txt")
If myftp.ABFTPLastError <> "" Then
    Msgbox(myftp.ABFTPLastError,
"")
Else
    Msgbox(
"file deleted!", "")
End If
ABFTPDisconnect
Disconnects from the ftp
Example:
myftp.ABFTPDisconnect()
ABFTPDownload (sourceFolder As String, sourceFile As String, targetFolder As String, targetFile As String)
Downloads a file from the ftp to the device
sourceFolder (String): folder on the ftp starting and ending with /
sourceFile (String) : filename on the ftp
targetFolder (String): folder on the device starting and ending with /
targetFile (String) : filename on the device
Example:
sdRoot = File.DirRootExternal &
"/"
myftp.ABFTPDownload(
"/upload/", "test.txt", sdRoot, "test2.txt")
If myftp.ABFTPLastError <> "" Then
    Msgbox(myftp.ABFTPLastError,
"")
Else
    Msgbox(
"File downloaded!, "")
End If
ABFTPLastError As String [read only]
returns the last error message if any
Example:
If myftp.ABFTPLastError <> "" Then
    Msgbox(myftp.ABFTPLastError,
"")
Else
    Msgbox(
"everything ok", "")
End If
ABFTPListFiles (listFolder As String) As String()
Returns a table of strings with the file names
listFolder (String): the folder to list
Example:
Dim myFiles() As String
myfiles = myftp.ABFTPListFiles(
"/upload/")
If myftp.ABFTPLastError <> "" Then
    Msgbox(myftp.ABFTPLastError,
"")
Else
    
For a = 0 To myfiles.Length - 1
        listview1.AddSingleLine(myfiles(a))
    
Next
End If
ABFTPUpload (sourceFolder As String, sourceFile As String, targetFolder As String, targetFile As String)
Uploads a file from the device to the ftp
sourceFolder (String): folder on the device starting and ending with /
sourceFile (String) : filename on the device
targetFolder (String): folder on the ftp starting and ending with /
targetFile (String) : filename on the ftp
Example:
sdRoot = File.DirRootExternal &
"/"
myftp.ABFTPUpload(sdRoot,
"test.txt","upload","test.txt")
If myftp.ABFTPLastError <> "" Then
    Msgbox(myftp.ABFTPLastError,
"")
Else
    Msgbox(
"file uploaded!","")
End If

Top