Command FTP_Login

4D Internet Commands

FTP_Login

version 6.5


FTP_Login (hostName; userName; password; ftp_ID{; welcomeText}) Integer

ParameterTypeDescription
hostNameStringHost name or IP address
userNameStringUser name
passwordStringPassword
ftp_IDLongintReference to this new FTP session
welcomeTextTextFTP Welcome text

Function result Integer Error Code

Description

The FTP_Login command establishes a connection with the FTP server at hostName and logs onto the system using the supplied userName and Password.

hostName is the host name or IP address of the remote system.

userName is the name of a user account recognized by the FTP server. Many FTP servers support guest access via an "anonymous" username. If you are logging in anonymously, it is customary to supply your e-mail address as the password.

password is the password for userName on the system.

ftp_ID is the long integer value obtained for the newly opened session. This value will be used in subsequent FTP commands. This parameter must be passed a 4D variable or field in order to accept the returned results.

welcomeText is an optional parameter which contains the text returned when the user logs into the system. Many FTP sites have a Welcome message displayed at the time of login. If specified, this parameter must be passed a 4D variable or field in order to accept the returned results.

Example

   $OK:=False
   Case of 
      : (FTP_Login ("ftp.4d.com";"anonymous";"[email protected]";vFTP_ID;vFTP_Msg)#0)
      : (FTP_Progress (-1;-1;"Progress window";"Getting requested file…";"*")#0)
      : (FTP_Send (vFTP_ID;"My Hard Drive:Documents ƒ:July Sales Report";"/pub/reports";1)#0)
      : (FTP_Logout (vFTP_ID)#0)
   Else
      $OK:=True   `all commands executed without error
   End case 

Note: For more information about this particular use of the Case of structure, please refer to Appendix A, Programming Tips.

See Also

FTP_Logout.