Sample code for 30+ languages & platforms
PureBasic

Wasabi FTP Upload

See more Wasabi Examples

Demonstrates how to upload a file to Wasabi using FTP.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkFtp2.pb"

Procedure ChilkatExample()

    success.i = 0

    ; This example assumes the Chilkat HTTP API to have been previously unlocked.
    ; See Global Unlock Sample for sample code.

    ftp.i = CkFtp2::ckCreate()
    If ftp.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Use the domain for the bucket you'll be managing.
    CkFtp2::setCkHostname(ftp, "s3.s3.us-west-1.wasabisys.com")

    ; Use your root account username (email address) and root account password
    CkFtp2::setCkUsername(ftp, "root_account_username")
    CkFtp2::setCkPassword(ftp, "root_account_password")
    CkFtp2::setCkSsl(ftp, 1)
    CkFtp2::setCkPort(ftp, 990)

    success = CkFtp2::ckConnect(ftp)
    If success = 0
        Debug CkFtp2::ckLastErrorText(ftp)
        CkFtp2::ckDispose(ftp)
        ProcedureReturn
    EndIf

    ; Upload a file (starfish.jpg) to the bucket named "chilkat"
    localFilePath.s = "qa_data/jpg/starfish.jpg"
    remoteBucketPath.s = "/chilkat/starfish.jpg"
    success = CkFtp2::ckPutFile(ftp,localFilePath,remoteBucketPath)
    If success = 0
        Debug CkFtp2::ckLastErrorText(ftp)
        CkFtp2::ckDispose(ftp)
        ProcedureReturn
    EndIf

    Debug "File uploaded."


    CkFtp2::ckDispose(ftp)


    ProcedureReturn
EndProcedure