Xbase++
Xbase++
Upload Multiple Files Matching Pattern
See more FTP Examples
The MPutFiles method can be called to upload all files matching a wildcarded filename pattern from a local filesystem directory.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oFtp
LOCAL nNumFilesUploaded
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oFtp := CreateObject("Chilkat.Ftp2")
oFtp:Hostname := "ftp.example.com"
oFtp:Username := "my_login"
oFtp:Password := "my_password"
// Connect and login to the FTP server.
nSuccess := oFtp:Connect()
IF (nSuccess != 1)
? oFtp:LastErrorText
oFtp:destroy()
RETURN
ENDIF
// Change to the remote directory where the files will be uploaded.
// for the FTP account.
nSuccess := oFtp:ChangeRemoteDir("junk")
IF (nSuccess != 1)
? oFtp:LastErrorText
oFtp:destroy()
RETURN
ENDIF
// Upload all files with filenames matching "c:/temp/ftp_*.asp"
nNumFilesUploaded := oFtp:MPutFiles("c:/temp/ftp_*.asp")
IF (nNumFilesUploaded < 0)
? oFtp:LastErrorText
oFtp:destroy()
RETURN
ENDIF
nSuccess := oFtp:Disconnect()
? Str(nNumFilesUploaded) + " Files Uploaded!"
oFtp:destroy()