GetFTPFile Method

Retrieves a file from an FTP server and saves it to the local hard disk.

Syntax

obj.GetFTPFile(Host String, RemoteFile String, DestinationLocalFile String, [AsciiText Boolean], [PortNumber Long], [LogonUserID String], [LogonPassword String], [AccessType Long])
Where obj is an OpScrUtil.INet object.

Parameters

Host The name of the FTP server, for example ftp.missioncritical.com.
RemoteFile The path and name of the file to be retrieved from the FTP server.
DestinationLocalFile The full path of the local file where the retrieved FTP file will be saved.
AsciiText (True/False) Determines if the file should be transferred in ASCII or binary mode. This parameter is optional. The default value is False.
PortNumber Allows specification of a port number other than the default FTP protocol port (21). This parameter is optional.
LogonUserID User ID used while logging onto FTP server. This parameter is optional. Leave blank to specify anonymous logon.
LogonPassword Password used while logging onto FTP server. This parameter is optional.
Access Type Flags specify options for Internet connection. This parameter is optional. This can be one of the following values:
INTERNET_OPEN_TYPE_PRECONFIG = 0 (default)
Retrieves the proxy or direct configuration from the registry.
INTERNET_OPEN_TYPE_DIRECT = 1
Resolves all host names locally.
INTERNET_OPEN_TYPE_PROXY = 3
Passes requests to the proxy unless a proxy bypass list is supplied and the name to be resolved bypasses the proxy. In this case, the function uses INTERNET_OPEN_TYPE_DIRECT.
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4
Retrieves the proxy or direct configuration from the registry and prevents the use of a startup JScript® (compatible with ECMA 262 language specification) or Internet Setup (INS) file.

Return Type

Boolean.

Example

To retrieve the latest_update.exe file from the ftp.missioncritical.com ftp site using the george user ID and the BlueSky password, enter:

Set obj = CreateObject("OpScrUtil.INet")
bOK = obj.GetFTPFile("ftp.missioncritical.com", "/Support/Downloads/latest_update.exe", False, , "george", "BlueSky")
If Not bOK Then
strError = obj.GetError()
End If

This example shows how to retrieve an FTP file from a remote server.