Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Default properties and methods of the FtpClient prototype.
FtpClient(server)   deprecated use helma.Ftp instead
Constructor for File objects, to send and receive files from an FTP server.

The FTP client needs Daniel Savarese's NetComponents library in the classpath in order to work.

Example:
var ftp = new FtpClient("ftp.mydomain.com");
parameters
String server as String, the address of the FTP Server to connect to
methods
  • login(username, password)
see
Methods
FtpClient. ascii()
Sets transfer mode to ascii for transmitting text-based data.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.ascii();
FtpClient. binary()
Sets transfer mode to binary for transmitting images and other non-text files.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.binary();
FtpClient. cd(dir)
Changes the working directory on the FTP server.

Example:
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");
parameters
String dir as String, the path that the remote working directory should be changed to
FtpClient. getFile(source, dest)
Transfers a file from the FTP server to the local file system.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.getFile(".htaccess", "htaccess.txt");
parameters
String source as String, the name of the file that should be downloaded
String dest as String, the name which the file should be stored under
see
FtpClient. getString(source)
Retrieves a file from the FTP server and returns it as string.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
var str = ftp.getString("messages.txt");
parameters
String source as String, the name of the file that should be downloaded
returns
String containing the data of the downloaded file
see
FtpClient. lcd(dir)
Changes the working directory of the local machine when being connected to an FTP server.

Example:
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");
parameters
String dir as String, the path that the local working directory should be changed to
FtpClient. login(username, password)
Logs in to the FTP server.

The function returns true if successful, false otherwise

Example:
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.
parameters
String username as String
String password as String
returns
Boolean true if the login was successful, otherwise false
FtpClient. logout()
Terminates the current FTP session.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.putFile("htaccess.txt", ".htaccess");
ftp.logout();
FtpClient. mkdir(name)
Creates a new directory on the server.

The name of the directory is determined as the function's string parameter. Returns false when an error occured (e.g. due to access restrictions, directory already exists etc.), otherwise true.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
if (ftp.mkdir("testdir"))
  ftp.cd("testdir")
else
  ftp.logout();
parameters
String name as String, the name of the directory to be created
returns
Boolean true if the directory was successfully created, false if there was an error
FtpClient. putFile(dest)
Transfers a file from the local file system to the remote server.

Returns true if the transmission was successful, otherwise false.

Example:
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.
parameters
String dest as String, the name of the destination file to be uploaded
returns
Boolean true if the file was successfully uploaded, false if there was an error
FtpClient. putString(source, dest)
Transfers text from a string to a file on the FTP server.

Example:
var ftp = new FtpClient("ftp.host.dom");
ftp.login("user", "pass");
ftp.putString("Hello, World!", "message.txt");
parameters
String source as String, the text content that should be uploaded
String dest as String, the name of the remote destination file
returns
Boolean true if the file was successfully uploaded, false if there was an error
Fri, 05 Feb 2010 17:40:04 GMT.

core framework

optional modules

java libraries

properties files