FTP For Powerbuilder

PowerBuilder 2025-07-27

FTP Wrapper for PowerBuilder

This library provides a COM-compatible wrapper around the FluentFTP library, designed specifically for use with PowerBuilder applications.

Thanks to

  • FluentFTP

Features

  • Simple FTP/FTPS operations with intuitive API
  • Connection profile management
  • Secure credential handling
  • Full PowerBuilder integration through COM

Installation

  1. Copy the FluentFtpWrapper.dll and connections.xml files to your application directory
  2. Register the COM library using: (If you use Modern powerbuilder, you can call directly without com, check about .net dll importer in PB IDE)
    regasm FluentFtpWrapper.dll /tlb:FluentFtpWrapper.tlb /codebase
    
  3. if you want use your custom key pair file, use sn tool that from .net framework sdk
    C:Program Files (x86)Microsoft SDKsWindowsv10.0AbinNETFX 4.8.1 Toolsx64sn.exe -k (keyfile.snk)
    

Configuration

The wrapper supports two configuration files:

  • Default configuration in the DLL directory (connections.xml)
  • User-specific configuration in %AppData%FtpClientWrapperconnections.xml

When both are present, user-specific profiles override the default ones with the same name.

Sample Configuration File

ftp.dev-server.com dev-user dev-password true ftp.production-server.com prod-user prod-password true ">
xml version="1.0" encoding="utf-8"?>
<FtpConnections>
  <Profile name="Development">
    <Host>ftp.dev-server.comHost>
    <Username>dev-userUsername>
    <Password>dev-passwordPassword>
    <UseSsl>trueUseSsl>
  Profile>
  <Profile name="Production">
    <Host>ftp.production-server.comHost>
    <Username>prod-userUsername>
    <Password>prod-passwordPassword>
    <UseSsl>trueUseSsl>
  Profile>
FtpConnections>

Usage from PowerBuilder

Initialize and Connect

FtpClientWrapper ftpClient
ftpClient = CREATE FtpClientWrapper

// Connect using a saved profile
string result = ftpClient.connectWithProfile("Development")

// Or connect directly
string result = ftpClient.connect("ftp.example.com", "username", "password", true)

Upload and Download Files

// Using current connection
string result = ftpClient.uploadFile("C:localfile.txt", "/remote/file.txt")
string result = ftpClient.downloadFile("/remote/file.txt", "C:localfile.txt")

// Using a specific profile without changing the current connection
string result = ftpClient.uploadFileWithProfile("C:localfile.txt", "/remote/file.txt", "Production")
string result = ftpClient.downloadFileWithProfile("/remote/file.txt", "C:localfile.txt", "Production")

// With explicit connection details
string result = ftpClient.uploadFile("C:localfile.txt", "/remote/file.txt", "ftp.example.com", "username", "password", true)

Manage Profiles

// List available profiles
string profiles[]
string result = ftpClient.listProfiles(profiles)

// Save a profile
string result = ftpClient.saveProfile("MyServer", "ftp.myserver.com", "username", "password", true)

// Delete a profile
string result = ftpClient.deleteProfile("MyServer")

Important Notes

  1. Each FTP operation creates a new connection for reliability with PowerBuilder
  2. Always check the return value for "SUCCESS:" or "ERROR:" prefixes
  3. Remember to call disconnect() after you're done with a session

License

MIT based open source project

下载源码

通过命令行克隆项目:

git clone https://github.com/yuseok-kim-edushare/FTP-For-Powerbuilder.git