Version 6.0.00
handle = ftp_open(remote, username, password [,timeout])
Returns a handle to an FTP connection
remote: URL of the server to connect to, e.g. ftp://172.16.2.1/ (must end in a trailing slash)
username: The username to connect with.
password: The password for the connection.
timeout: Optional - sets the length in seconds before the connection is terminated on a pending connection. Default 0, infinite timeout.
example:
declare local handle(8,.0);
handle = ftp_open("ftp://172.16.2.1/","logan","mypassword","10")
status = ftp_chdir(handle, directory) Changes the current FTP directory for certain commands.
ftp_rename, ftp_mkdir, ftp_rmdir, ftp_delete, ftp_list, ftp_pwd
handle: Handle to the FTP connection.
directory: Directory to switch to.
Returns "0" or a negated libcurl error.
example:
status = ftp_chdir(handle, "directory")
status = ftp_put(handle, local, remote [, show progress])
Send a file to a FTP server.
handle: Handle to an FTP connection.local: Local file to send.
remote: URL to upload to (Must be URL, cannot use relative paths).
show progress: "0" hide progress bar, "1" show progress bar, default "1".
Returns "0" or a negated libcurl error.
example:
status = ftp_put(handle, "/send/file.txt","ftp://server/path/to/file.txt", "1")
status = ftp_get(handle, local, remote [, show progress])
Get a file from a FTP server.
handle: Handle to an FTP connection.
local: Local file to save to.
remote: URL to get from (Must be URL, cannot use relative paths).
show progress: "0" hide progress bar, "1" show progress bar, default "1".
Returns "0" or a negated libcurl error.
example:
status = ftp_get(handle, "/save/file.txt","ftp://server/path/to/file.txt", "1")
status = ftp_rename(handle, from, to)
Rename a file on a FTP server.
handle: Handle to an FTP connection.
from: File to rename.
to: New file name.
Returns "0" or a negated libcurl error.
example:
status = ftp_chdir(handle, "mydirectory")
status = ftp_rename(handle, "original.txt","renamed.txt")
status = ftp_mkdir(handle, directory)
Create a directory on a FTP server.
handle: Handle to an FTP connection.
directory: Path to create new directory, can be relative or absolute.
Returns "0" or a negated libcurl error.
status = ftp_chdir(handle, "mydirectory")
status = ftp_mkdir(handle, "newdirectory")
status = ftp_rmdir(handle, directory)
Remove a directory on a FTP server.
handle: Handle to an FTP connection.
directory: Directory to remove.
Returns "0" or a negated libcurlerror.
example:
status = ftp_chdir(handle, "mydirectory")
status = ftp_rmdir(handle, "todelete")
status = ftp_delete(handle, remote)
Delete a file on a FTP server.
handle: Handle to an FTP connection.
remote: File to delete.
Returns "0" or a negated libcurl error.
example:
status = ftp_chdir(handle, "mydirectory")
status = ftp_delete(handle, "todelete")
status = ftp_close(handle)
Closes an open FTP handle.
handle: Handle to an FTP connection.
Returns "0" or a negated libcurl error
error = ftp_error(code)
Translates a FTP error into a human readable error string.
code: The numeric error code returned by a FTP method.
Returns the associated error string.
num = ftp_list(handle, array)
Gets a listing of all files and directories in the current FTP directory.
handle: Handle to an FTP connection.
array: A non-aliased array to return the list of files through.
Returns the number of elements in the returned array, or a negated libcurl error.
example:
dim array(); ' 0 size arrays are now allowed by filePro
num = ftp_list(handle, array)
if: num lt "0" ' num should contain the number of elements in array
then: errorbox ftp_error(num); xx=ftp_close(handle); end
then: xx=selectbox(array)
path = ftp_pwd(handle)
Get the PWD of the FTP handle.
handle: Handle to an FTP connection.
Returns the PWD of the ftp handle.