Class: | FTP_SERVICE |
Description: | Get file from the FTP Server |
Type | Character |
Direction | Input |
Type | Character |
Direction | Input |
Type | Boolean |
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. |
FTP_TRANSFER_TYPE_UNKNOWN | Defaults to FTP_TRANSFER_TYPE_BINARY. |
INTERNET_FLAG_TRANSFER_ASCII | Transfers the file as ASCII. |
INTERNET_FLAG_TRANSFER_BINARY | Transfers the file as binary. |
LPARAMETERS INP lcRemoteFile, INP lcLocalFile, INP llFailIfExists, INP lnFlag LOCAL fResult, lnFail IF EMPTY(m.lcRemoteFile) This.SetExtendedError(_FTPS_UE_FNDEF,"lcRemoteFile") RETURN .F. ENDIF IF EMPTY(m.lcLocalFile) This.SetExtendedError(_FTPS_UE_FNDEF,"lcLocalFile") RETURN .F. ENDIF lnFlag=IIF(PCOUNT()<4,FTP_TRANSFER_TYPE_UNKNOWN,m.lnFlag) IF This.OpenFTPConnection(This.cCurrentDir) && Open an FTP Handle lnFail=IIF(m.llFailIfExists,1,0) lcLocalFile = m.lcLocalFile + cNULL lcRemoteFile = m.lcRemoteFile + cNULL =This.BeforeGetFTPFile(@m.lcRemoteFile, @m.lcLocalFile, m.llFailIfExists,m.lnFlag) fResult = FtpGetFile(This.nConnect_Handle, @m.lcRemoteFile, @m.lcLocalFile, m.lnFail, ; FILE_ATTRIBUTE_NORMAL, BITOR(This.nCachingType,m.lnFlag), 0) =This.GetExtendedError() =This.AfterGetFTPFile(@m.lcRemoteFile, @m.lcLocalFile, m.llFailIfExists,m.lnFlag,m.fResult) =IIF(This.lMultiOperations,.T.,This.CloseFTPConnection()) && Close FTP Handle RETURN m.fResult = 1 ENDIF RETURN .F.