Class: | FTP_SERVICE |
Type | Character |
Direction | Input |
Type | Integer |
Direction | Input |
Optional |
Value | Description |
FTP_TRANSFER_TYPE_ASCII | ASCII mode |
FTP_TRANSFER_TYPE_BINARY | Binnary mode. |
Type | Integer |
Direction | Input |
Optional |
Type | Integer |
By reference | |
Direction | Input/Output |
Optional |
LOCAL loFTP,lcPom #INCLUDE "ftp.h" SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') IF loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21") =loFTP.FtpCommand("SIZE any.txt", FTP_TRANSFER_TYPE_BINARY,0,.NULL.) ?loFTP.GetExtendedErrorCode() && 0 ?loFTP.GetExtendedErrorMsg() && 213 file size =loFTP.FtpCommand("NOOP", FTP_TRANSFER_TYPE_BINARY,0,.NULL.) =loFTP.CloseInternet() ENDIF RELEASE PROCEDURE ftp.prg
LPARAMETERS INP lcCommand,INP liFlags,OPT_INP liContext,OPT_CHNGREF lihFTP LOCAL fResult IF This.OpenFTPConnection(This.cCurrentDir) && Open an FTP Handle liFlags=IIF(PCOUNT()<2,FTP_TRANSFER_TYPE_BINARY,liFlags) liContext=IIF(PCOUNT()<3,0,liContext) lihFTP=IIF(ISNULL(lihFTP),-1,0) lcCommand = lcCommand + cNULL =This.BeforeFTPCommand(@lcCommand, liFlags, liContext,lihFTP) fResult = FtpCommand(This.nConnect_Handle, IIF(lihFTP=-1,0,1), liFlags, @lcCommand,liContext,@lihFTP) =This.GetExtendedError() =This.AfterFTPCommand(@lcCommand, liFlags, liContext,lihFTP,fResult) =IIF(This.lMultiOperations,.T.,This.CloseFTPConnection()) && Close FTP Handle RETURN fResult = 1 ENDIF RETURN .F.