CkFtp C++ Class Reference

CkFtp

Free and Unsupported File Transfer Protocol (FTP) Component.

Reference Index
Chilkat Home
Example Programs

Properties

Hostname
IsConnected
ListPattern
NumFilesAndDirs
Passive
Password
Port
Proxy
UseIEProxy
Username
Utf8
Version

Methods

ChangeRemoteDir
Connect
CreateRemoteDir
DeleteMatching
DeleteRemoteFile
Disconnect
GetCreateTime
GetCurrentDirListing
GetCurrentRemoteDir
GetFile
GetFilename
GetIsDirectory
GetLastAccessTime
GetLastModifiedTime
GetRemoteFileBinaryData
GetRemoteFileTextData
GetSize
LastErrorHtml
LastErrorText
LastErrorXml
MGetFiles
MPutFiles
PutFile
PutFileFromBinaryData
PutFileFromTextData
RemoveRemoteDir
RenameRemoteFile
SaveLastError

Properties

void get_Hostname(CkString &str);
void put_Hostname(const char *newVal);

The FTP server hostname.

bool get_IsConnected(void);

Returns true if currently connected and logged into an FTP server, otherwise returns false.

void get_ListPattern(CkString &strPattern);
void put_ListPattern(const char *pattern);

A wildcard pattern, defaulting to "*" that determines the files and directories included in the following properties and methods: NumFilesAndDirs, GetCreateTime, GetFilename, GetIsDirectory, GetLastAccessTime, GetModifiedTime, GetSize.

long get_NumFilesAndDirs(void);

The number of files and sub-directories in the current remote directory that match the ListPattern. (The ListPattern defaults to "*", so unless changed, this is the total number of files and sub-directories.)

bool get_Passive(void);
void put_Passive(bool newVal);

Set to true for FTP to operate in passive mode, otherwise set to false for non-passive (the default).

void get_Password(CkString &str);
void put_Password(const char *newVal);

Password for logging into the FTP server.

long get_Port(void);
void put_Port(long newVal);

Port number. Automatically defaults to the default port for the FTP service.

void get_Proxy(CkString &str);
void put_Proxy(const char *newVal);

The name of a proxy server when accessing FTP via a proxy .

bool get_UseIEProxy(void);
void put_UseIEProxy(bool newVal);

Set this property to true to use the FTP proxy configured for Internet Explorer.

void get_Username(CkString &str);
void put_Username(const char *newVal);

Username for logging into the FTP server. Defaults to "anonymous".

bool get_Utf8(void) const;
void put_Utf8(bool b);

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

void get_Version(CkString &str);

Version of the component, such as "1.0.0"

Methods

bool ChangeRemoteDir(const char *relativeDirPath);

Changes the current remote directory.

bool Connect(void);

Connects and logs in to the FTP server using the username/password provided in the component properties.

bool CreateRemoteDir(const char *dir);

Creates a directory on the FTP server. Returns true for success, false for failure. If the directory already exists, a new one is not created and false is returned.

long DeleteMatching(const char *remotePattern);

Deletes all the files in the current remote FTP directory matching the pattern. Returns the number of files deleted, or -1 for failure. The pattern is a string such as "*.txt", where any number of "*" wildcard characters can be used. "*" matches 0 or more of any character, and "?" matches exactly 1 of any character.

bool DeleteRemoteFile(const char *filename);

Deletes a file on the FTP server.

bool Disconnect(void);

Disconnects from the FTP server, ending the current session.

bool GetCreateTime(long index, FILETIME &fTime);

Returns the create time for the Nth file or sub-directory in the current remote directory. The first file/dir is at index 0, and the last one is at index (NumFilesAndDirs-1)

bool GetCurrentDirListing(const char *pattern, CkString &strListing);

Returns (in XML format) the files and directories in the current directory matching the pattern. Passing "*.*" will return all the files and directories.

bool GetCurrentRemoteDir(CkString &str);

Returns the current remote directory.

bool GetFile(const char *remoteFilename, const char *localFilename);

Copies a file from the FTP server to the local filesystem. Returns true for success and false for failure.[

bool GetFilename(long index, CkString &str);

Returns the filename for the Nth file or sub-directory in the current remote directory. The first file/dir is at index 0, and the last one is at index (NumFilesAndDirs-1)

bool GetIsDirectory(long index);

Returns1 for a sub-directory and 0 for a file, for the Nth entry in the current remote directory. The first file/dir is at index 0, and the last one is at index (NumFilesAndDirs-1)

bool GetLastAccessTime(long index, FILETIME &fTime);

Returns the last access time for the Nth file or sub-directory in the current remote directory. The first file/dir is at index 0, and the last one is at index (NumFilesAndDirs-1)

bool GetLastModifiedTime(long index, FILETIME &fTime);

Returns the last modified time for the Nth file or sub-directory in the current remote directory. The first file/dir is at index 0, and the last one is at index (NumFilesAndDirs-1)

bool GetRemoteFileBinaryData(const char *remoteFilename, CkByteData &data);

Returns the contents of a remote file. A null is returned on failure.

bool GetRemoteFileTextData(const char *remoteFilename, CkString &str);

Returns the contents of a remote file. A null is returned on failure.[

long GetSize(long index);

Returns the size of the Nth remote file in the current directory.

void LastErrorHtml(CkString &str);

Error information in HTML format for the last method called.

void LastErrorText(CkString &str);

Error information in plain-text format for the last method called.

void LastErrorXml(CkString &str);

Error information in XML format for the last method called.

long MGetFiles(const char *remotePattern, const char *localDir);

Copies all the files in the current remote FTP directory to a local directory. To copy all the files in a remote directory, set remotePattern to "*.*" The pattern can contain any number of "*" or "?" characters where "*" matches 0 or more of any character, and "?" matches any single character. The return value is the number of files transferred, and on error, a value of -1 is returned. Detailed information about the transfer can be obtained from the XML log.

long MPutFiles(const char *pattern);

Copies all the files matching pattern on the local computer to the current remote FTP directory. The pattern parameter can include directory information, such as "C:/my_dir/*.txt" or it can simply be a pattern such as "*.*" that matches the files in the application's current directory. Subdirectories are not recursed. The return value is the number of files copied, with a value of -1 returned for errors. Detailed information about the transfer can be obtained from the XML log.[

bool PutFile(const char *localFilename, const char *remoteFilename);

Copies a local file to the current directory on the FTP server.[

bool PutFileFromBinaryData(const char *remoteFilename, CkByteData &binaryData);

Creates a file on the remote server containing the data passed in a byte array. Returns true for success, false for failure.

bool PutFileFromTextData(const char *remoteFilename, const char *textData);

Creates a file on the remote server containing the data passed in a string. Returns true for success, false for failure.[

bool RemoveRemoteDir(const char *dir);

Removes a directory from the FTP server.

bool RenameRemoteFile(const char *existingFilename, const char *newFilename);

Renames a file on the FTP server.

bool SaveLastError(const char *filename);

Saves the last error information to an XML formatted file.

Copyright 2000-2006 Chilkat Software, Inc.