How to Program with FTP Functions

FTP Internet functions allow a user to create a connection with an FTP server, transfer files and bitmaps, perform remote file operations, perform remote director operations, and browse remote directories for files. The following topics provide a systematic approach to understanding how to program with the LEADTOOLS FTP functions.

Connecting and Disconnecting to the FTP Server

The first step in working with a FTP server is to use L_InetFtpConnect to connect to the desired FTP server. A user can connect with a user name and password, or as an "anonymous" user. To disconnect from the FTP server use the L_InetFtpDisconnect function.

File Manipulation

The user can store files on the FTP server via L_InetFtpSendFile. To get a file from the FTP server and store it on the local system, use the function L_InetFtpGetFile. In addition, a remote file on the server can be renamed using L_InetFtpRenameFile. Finally, L_InetFtpDeleteFile can delete a remote file on the server.

Directory Manipulation

The user can create directories on the FTP server via L_InetFtpCreateDir. To delete a directory from an FTP server, use the function L_InetFtpDeleteDir. L_InetFtpChangeDir changes the working directory on the FTP server. Finally, L_InetFtpGetCurrentDir retrieves the current directory for the specified FTP session.

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 L_InetFtpBrowseDir. The search results can be obtained from the FTPBROWSECALLBACK. A call to this callback function is automatically generated after calling L_InetFtpBrowseDir.

Uploading a Bitmap to a ftp server

The LEADTOOLS FTP functions support uploading a LEAD bitmap. Use L_InetFtpSendBitmap function to manage asynchronous uploading of a bitmap.