How to Program with the LInetFtp Class
The LInetFtp class allows a user to create a connection with an FTP server, transfer files and bitmaps, perform remote file operations, perform remote directory operations, and browse remote directories for files.
The following topics provide a systematic approach to understanding how to program with the LEADTOOLS LInetFtp class.
Connecting and Disconnecting to the FTP Server
The first step in working with an FTP server is to connect to the desired FTP server. A connection can be established when a class object is created using the LInetFtp::LInetFtp constructor, or by calling LInetFtp::Connect. A user can connect with a user name and password, or as an "anonymous" user. To disconnect from the FTP server use the LInetFtp::Disconnect function or the class destructor LInetFtp::~LInetFtp.
File Manipulation
A user can store files on the FTP server via LInetFtp::SendFile. To get a file from the FTP server and store it on the local system, use the function LInetFtp::GetFile. In addition, a remote file on the server can be renamed using LInetFtp::RenameFile. Finally, LInetFtp::RemoveFile can delete a remote file on the server.
Directory Manipulation
A user can create directories on the FTP server via LInetFtp::CreateDir. To delete a directory from an FTP server, use the function LInetFtp::DeleteDir. LInetFtp::ChangeDir changes the working directory on the FTP server. Finally, LInetFtp::GetCurrentDir retrieves the current directory for the specified FTP connection.
Directory Browsing (Search results)
Any directory can be browsed on the FTP server. In addition, a file search can also be performed. Both can be implemented by calling LInetFtp::BrowseDir. The search results can be obtained from LInetFtp::BrowseCallBack. A call to this callback function is automatically generated after calling LInetFtp::BrowseDir.
Uploading a Bitmap to an FTP Server
The LEADTOOLS LInetFtp class supports uploading a LEAD bitmap. Use LInetFtp::SendBitmap function to manage asynchronous uploading of a bitmap.