Visual FoxPro
Visual FoxPro
Upload Directory Tree
See more FTP Examples
Upload an entire directory tree from the local filesystem to an FTP server.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loFtp
lnSuccess = 0
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loFtp = CreateObject('Chilkat.Ftp2')
loFtp.KeepSessionLog = 1
loFtp.Hostname = "ftp.example.com"
loFtp.Username = "login"
loFtp.Password = "password"
* Connect and login to the FTP server.
lnSuccess = loFtp.Connect()
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
RELEASE loFtp
CANCEL
ENDIF
* Set the current remote directory to the root where the
* directory tree will be uploaded.
lnSuccess = loFtp.ChangeRemoteDir("/something")
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
RELEASE loFtp
CANCEL
ENDIF
* Upload the entire directory tree rooted at c:/temp/something
lnSuccess = loFtp.PutTree("c:/temp/something")
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
RELEASE loFtp
CANCEL
ENDIF
lnSuccess = loFtp.Disconnect()
? loFtp.SessionLog
RELEASE loFtp