HttpClient.GetFile Method (String, String, HttpTransferOptions, Int64)
Transfer data from the web server and store it in a file on the local system.
[Visual Basic]
Overloads Public Function GetFile( _
ByVal
localFile As
String, _
ByVal
remoteFile As
String, _
ByVal
options As
HttpTransferOptions, _
ByVal
offset As
Long _
) As
Boolean
[C#]
public
bool GetFile(
string localFile,
string remoteFile,
HttpTransferOptions options,
long offset
);
Parameters
- localFile
- A string that specifies the file on the local system that will be created. If the file already exists, it will be
overwritten. The file pathing and name conventions must be that of the local host.
- remoteFile
- A string that specifies the resource on the server that will be accessed. If the resource specifies a file, then the
contents of the file will be returned by the server. If the resource specifies a script or other executable content, it
will be executed and the output will be transferred to the local system. The resource name should be specified using an
absolute path that begins with a leading slash character.
- options
-
An HttpTransferOptions enumeration value which specifies
one or more options when transferring the data from the server to the local system.
- offset
- A integer value which specifies the offset where the file transfer should begin. A value of zero specifies that the
file transfer should start at the beginning of the file. A value greater than zero is typically used to restart a transfer
that has not completed successfully. Note that specifying a non-zero offset requires that the server support the option to
restart file transfers.
Return Value
This method returns a boolean value. If the method succeeds, the return value is true. If the method
fails, the return value is false. To get extended error information, check the value of the
LastError property.
Remarks
The GetFile method downloads a 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.
See Also
HttpClient Class |
SocketTools Namespace |
HttpClient.GetFile Overload List