Copy a file from the server to the local system.
object.GetFile( LocalFile, RemoteFile,
[Options], [Offset] )
- A string that specifies the file on the local system that will
be created, overwritten or appended to. The file pathing and name
conventions must be that of the local host.
- A string that specifies the file on the server that will
be transferred to the local system. The file pathing and name
conventions must be that of the server.
- An optional numeric value which specifies one or more options. This
argument may be any one of the following values:
|This option specifies the default transfer mode should
be used. If the local file exists, it will be overwritten with
the contents of the remote file. If the Options argument is
omitted, this is the transfer mode which will be used.
|If the resource being downloaded from the server is
textual, the data is automatically converted so that the end of
line character sequence is compatible with the Windows
platform. Individual carriage return or linefeed characters are
converted to carriage return/linefeed character sequences.
|This option informs the server that the client is willing
to accept compressed data. If the server supports compression
for the specified resource, then the data will be automatically
expanded before being returned to the caller. This option is
selected by default if compression has been enabled by setting
the Compression property to True. This option is ignored
if the Offset parameter is non-zero.
|This option causes the client to accept error data from the
server if the request fails. If this option is specified, an
error response from the server will not cause the method to
fail. Instead, the response is returned to the client and the
method will succeed. If this option is used, your application
should check the ResultCode property to obtain the
HTTP status code returned by the server. This will enable you to
determine if the operation was successful.
- An optional integer value that specifies a byte offset into the
file. If this value is greater than zero, the server must support the
ability to specify a byte range with the request to download the
file, otherwise this method will fail.
A value of zero is returned if the operation was successful,
otherwise a non-zero error code is returned which indicates the cause
of the failure.
The GetFile method copies an existing file from the server
to the local system. This method will cause the current thread to
block until the file transfer completes, a timeout occurs or the
transfer is canceled. During the transfer, the OnProgress
event will fire periodically, enabling the application to update any
user interface objects such as a progress bar.
Specifying the httpTransferCompress option does not guarantee
that the data returned by the server will actually be compressed, it
only informs the server that the client is willing to accept compressed
data. Whether or not a particular resource is compressed depends on the
server configuration, and the server may decide to only compress certain
types of resources, such as text files.
If compression has been enabled and the server returns compressed
data, it will be automatically expanded before being returned to the
caller. If the application is using the OnProgress event to
determine the amount of data being returned by the server, it is
important to keep in mind that the values reflect the size of the