## helma.Ftp

    Object
       |
       +--helma.Ftp

This class represents a FTP client, providing access to an FTP server. The FTP client needs Daniel Savarese's NetComponents library in the classpath in order to work.
Defined in Ftp.js

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Constructor Summary
`helma.Ftp(<String> server)` Constructor for FTP client objects, to send and receive files from an FTP server.

Properties Summary
`Object` | `server`
`Object` | `status`

Methods Summary
`Object` | `active()` Switches the connection to use active mode.
`Object` | `ascii()` Sets transfer mode to ascii for transmitting text-based data.
`Object` | `binary()` Sets transfer mode to binary for transmitting images and other non-text files.
`Object` | `cd(path)` Changes the working directory on the FTP server.
`Object` | `deleteFile(remoteFile)`
`Object` | `dir(path)`
`Object` | `getFile(<String> remoteFile, <String> localFile)` Transfers a file from the FTP server to the local file system.
`Object` | `getString(remoteFile)`
`Object` | `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.
`Object` | `logout()` Terminates the current FTP session.
`Boolean` | `mkdir(<String> dir)` Creates a new directory on the server.
`Object` | `passive()` Switches the connection to use passive mode.
`Boolean` | `putFile(<String> localFile, <String> remoteFile)` Transfers a file from the local file system to the remote server.
`Boolean` | `putString(<String> str, <String> remoteFile, <String> charset)` Transfers text from a string to a file on the FTP server.
`Object` | `pwd()`
`Boolean` | `rmdir(<String> dir)` Deletes a directory on the FTP server.
`Object` | `setReadTimeout(timeout)` Set the default timeout in milliseconds to use when opening a socket.
`Object` | `setTimeout(timeout)` Sets the timeout in milliseconds to use when reading from the data connection.

Constructor Detail

### helma.Ftp

    helma.Ftp(<String> server)

Constructor for FTP client objects, to send and receive files from an FTP server.

Parameters:

`server` - as String, the address of the FTP Server to connect to

Properties Detail

### server

    Object server

### status

    Object status

Method Detail

### active

    Object active()

Switches the connection to use active mode.

### ascii

    Object ascii()

Sets transfer mode to ascii for transmitting text-based data.

### binary

    Object binary()

Sets transfer mode to binary for transmitting images and other non-text files.

### cd

    Object cd(path)

Changes the working directory on the FTP server.

Parameters:

`dir` - as String, the path that the remote working directory should be changed to

### deleteFile

    Object deleteFile(remoteFile)

### dir

    Object dir(path)

### getFile

    Object getFile(<String> remoteFile, <String> localFile)

Transfers a file from the FTP server to the local file system.

Parameters:

`remoteFile` - as String, the name of the file that should be downloaded

`localFile` - as String, the name which the file should be stored under

See:

- cd()
- lcd()

### getString

    Object getString(remoteFile)

### lcd

    Object lcd(<String> dir)

Changes the working directory of the local machine when being connected to an FTP server.

Parameters:

`dir` - as String, the path that the local working directory should be changed to

### login

    Boolean login(<String> username, <String> password)

Logs in to the FTP server.

Parameters:

`username` - as String

`password` - as String

Returns:

Boolean true if the login was successful, otherwise false

### logout

    Object logout()

Terminates the current FTP session.

### mkdir

    Boolean mkdir(<String> dir)

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.

Parameters:

`dir` - 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

### passive

    Object passive()

Switches the connection to use passive mode.

### putFile

    Boolean putFile(<String> localFile, <String> remoteFile)

Transfers a file from the local file system to the remote server.
Returns true if the transmission was successful, otherwise false.

Parameters:

`localFile` - as String, the name of the file to be uploaded

`remoteFile` - as String, the name of the remote destination file

Returns:

Boolean true if the file was successfully uploaded, false if there was an error

### putString

    Boolean putString(<String> str, <String> remoteFile, <String> charset)

Transfers text from a string to a file on the FTP server.

Parameters:

`str` - as String, the text content that should be uploaded

`remoteFile` - as String, the name of the remote destination file

`charset` - as String, optional

Returns:

Boolean true if the file was successfully uploaded, false if there was an error

### pwd

    Object pwd()

### rmdir

    Boolean rmdir(<String> dir)

Deletes a directory on the FTP server.

Parameters:

`dir` - as String, the name of the directory to be deleted

Returns:

Boolean true if the deletion was successful, false otherwise

### setReadTimeout

    Object setReadTimeout(timeout)

Set the default timeout in milliseconds to use when opening a socket.

### setTimeout

    Object setTimeout(timeout)

Sets the timeout in milliseconds to use when reading from the data connection.

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Documentation generated by JSDoc on Thu Apr 5 01:59:00 2007