=
Object.OpenFTPConnection
Parameter
-
lcCurrentFolder
-
Current folder
Type |
Character |
By reference |
|
Direction |
Input |
The startup folder afater connecting to FTP server. If this parameter empty, then startup folder will be default FTP server's current folder fro logiing user.
The return value is .T. if is connected to ftp server or .F. is not.
Source Code
LPARAMETERS OPT_INP lcCurrentFolder
LOCAL nHandle, lnConnect_Handle
IF This.nConnect_Handle>0
RETURN .T.
ENDIF
* Open FTP Site
lnConnect_Handle = InternetConnect(This.nInet_Handle, (This.cIPAddress), VAL(This.cPort), ;
(This.cUserName), (This.cPassword), INTERNET_SERVICE_FTP, This.nFlags, 0)
This.GetExtendedError()
IF lnConnect_Handle = 0
RETURN .F.
ENDIF
IF PCOUNT()=0 OR EMPTY(m.lcCurrentFolder)
lcCurrentFolder = SPACE(MAX_PATH)
fResult = FtpGetCurrentDirectory(m.lnConnect_Handle, @m.lcCurrentFolder, MAX_PATH)
This.GetExtendedError()
ELSE
fResult = FtpSetCurrentDirectory(m.lnConnect_Handle, @m.lcCurrentFolder)
ENDIF
IF m.fResult = 1
This.cCurrentDir = LEFT(m.lcCurrentFolder,AT(CHR(0),m.lcCurrentFolder)-1)
This.nConnect_Handle = m.lnConnect_Handle
RETURN .T.
ELSE
This.GetExtendedError() && Only Get extended Error information when there is an error
RETURN .F.
ENDIF