OpenFtpConnection Method
Class: FTP_SERVICE
=
Object.OpenFtpConnection
Parameter
lcCurrentFolder
Current folder
Type Character
Direction Input
The startup folder afater connectiong to FTP server.
Return value Boolean
The return value is .T. if is connected to ftp server or .F. is not.



See also
Expand/Collapse source code of procedure OpenFtpConnection Source Code
      LPARAMETERS lcCurrentFolder
      LOCAL nHandle, lnConnect_Handle
      IF This.nConnect_Handle>0 AND .T. && is Valid??
         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(lcCurrentFolder)
         lcCurrentFolder = SPACE(MAX_PATH)      
         fResult = FtpGetCurrentDirectory(lnConnect_Handle, @lcCurrentFolder, MAX_PATH)
         This.GetExtendedError()

         IF fResult != 0
            This.cCurrentDir = lcCurrentFolder
         ENDIF
      ELSE
         lcCurrentFolder=This.cCurrentDir
         fResult = FtpSetCurrentDirectory(lnConnect_Handle, @lcCurrentFolder)
      ENDIF

      IF fResult = 1
         This.nConnect_Handle = lnConnect_Handle
         RETURN .T.
      ELSE
         This.GetExtendedError()     && Only Get extended Error information when there is an error
         RETURN .F.
      ENDIF