Object | +--FtpClient
Deprecated use {link helma.Ftp} instead
Defined in FtpClient.js
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| Constructor Summary | |
FtpClient(<String> server)
Constructor for File objects, to send and receive files from an FTP server. |
|
| Methods Summary | |
void
|
ascii()
Sets transfer mode to ascii for transmitting text-based data. |
void
|
binary()
Sets transfer mode to binary for transmitting images and other non-text files. |
void
|
cd(<String> dir)
Changes the working directory on the FTP server. |
void
|
getFile(<String> source,<String> dest)
Transfers a file from the FTP server to the local file system. |
String
|
getString(<String> source)
Retrieves a file from the FTP server and returns it as string. |
void
|
lcd(<String> dir)
Changes the working directory of the local machine when being connected to an FTP server. |
Boolean
|
login(<String> username,<String> password)
Logs in to the FTP server. |
void
|
logout()
Terminates the current FTP session. |
Boolean
|
mkdir(<String> name)
Creates a new directory on the server. |
Boolean
|
putFile(<String> dest)
Transfers a file from the local file system to the remote server. |
Boolean
|
putString(<String> source,<String> dest)
Transfers text from a string to a file on the FTP server. |
| Constructor Detail |
FtpClient(<String> server)
var ftp = new FtpClient("ftp.mydomain.com");
server - as String, the address of the FTP Server to connect to
| Method Detail |
void ascii()
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.ascii();
void binary()
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.binary();
void cd(<String> dir)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
// use absolute pathname
ftp.cd("/home/users/fred/www");
// change to parent directory
ftp.cd("..");
// use relative pathname
ftp.cd("images");
dir - as String, the path that the remote working directory should be changed to
void getFile(<String> source,<String> dest)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.getFile(".htaccess", "htaccess.txt");
source - as String, the name of the file that should be downloaded
dest - as String, the name which the file should be stored under
String getString(<String> source)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
var str = ftp.getString("messages.txt");
source - as String, the name of the file that should be downloaded
void lcd(<String> dir)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
// use absolute pathname
ftp.lcd("/home/users/fred/www");
// change to parent directory
ftp.lcd("..");
// use relative pathname
ftp.lcd("images");
dir - as String, the path that the local working directory should be changed to
Boolean login(<String> username,<String> password)
var ftp = new FtpClient("ftp.host.dom");
if (ftp.login("user", "pass"))
res.write("User logged in.");
else
res.write("Unable to log in.");
User logged in.
username - as String
password - as String
void logout()
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.putFile("htaccess.txt", ".htaccess");
ftp.logout();
Boolean mkdir(<String> name)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
if (ftp.mkdir("testdir"))
ftp.cd("testdir")
else
ftp.logout();
name - as String, the name of the directory to be created
Boolean putFile(<String> dest)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
if (ftp.putFile("testfile"))
res.write("File transferred successfully.");
else
res.write("Transfer error.");
File transferred successfully.
dest - as String, the name of the destination file to be uploaded
Boolean putString(<String> source,<String> dest)
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.putString("Hello, World!", "message.txt");
source - as String, the text content that should be uploaded
dest - as String, the name of the remote destination file
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |