(PureBasic) Wasabi FTP Download
Demonstrates how to download a file from a Wasabi bucket using FTP.
Note: This example requires Chilkat v9.5.0.89 or greater.
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_output/starfish.jpg"
remoteBucketPath.s = "/chilkat/starfish.jpg"
success = CkFtp2::ckGetFile(ftp,remoteBucketPath,localFilePath)
If success = 0
Debug CkFtp2::ckLastErrorText(ftp)
CkFtp2::ckDispose(ftp)
ProcedureReturn
EndIf
Debug "File uploaded."
CkFtp2::ckDispose(ftp)
ProcedureReturn
EndProcedure
|