Class: | FTP_SERVICE |
Type | Character |
Direction | Input |
Type | Character |
Direction | Input |
Type | Numeric |
Direction | Input |
Value | Description |
FTP_TRANSFER_TYPE_ASCII | Transfers the file as ASCII. |
FTP_TRANSFER_TYPE_BINARY | Transfers the file as binary. |
LOCAL loFTP SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') IF loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21") IF loFTP.PutFTPFile("any.txt","local.txt") ?STRTRAN("File %File% uploaded","%File%","local.txt") ELSE ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg() ENDIF =loFTP.CloseInternet() ENDIF RELEASE PROCEDURE ftp.prg
LPARAMETERS INP lcRemoteFile, INP lcLocalFile, INP lnFlag LOCAL fResult IF EMPTY(lcRemoteFile) This.SetExtendedError(_FTPS_UE_FNDEF,"lcRemoteFile") RETURN .F. ENDIF IF EMPTY(lcLocalFile) This.SetExtendedError(_FTPS_UE_FNDEF,"lcLocalFile") RETURN .F. ENDIF lnFlag=IIF(PCOUNT()<3,FTP_TRANSFER_TYPE_UNKNOWN,lnFlag) IF This.OpenFTPConnection(This.cCurrentDir) && Open an FTP Handle lcRemoteFile = lcRemoteFile + cNULL lcLocalFile = lcLocalFile + cNULL =This.BeforePutFTPFile(@lcRemoteFile, @lclocalFile,lnFlag) fResult = FtpPutFile(This.nConnect_Handle, @lcLocalFile, @lcRemoteFile, ; BITOR(This.nCachingType,lnFlag), 0) =This.GetExtendedError() =This.AfterPutFTPFile(@lcRemoteFile, @lclocalFile,lnFlag,fResult) =IIF(This.lMultiOperations,.T.,This.CloseFTPConnection()) && Close FTP Handle RETURN fResult = 1 ENDIF RETURN .F.