HttpGetFile
INT HttpGetFile(
HCLIENT hClient,  
LPCTSTR lpszLocalFile,  
LPCTSTR lpszRemoteFile,  
DWORD dwOptions,  
DWORD dwReserved  
);

The HttpGetFile function transfers the specified file on the remote server to the local system.

Parameters

hClient
Handle to the client session.
lpszLocalFile
A pointer to the null-terminated 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.
lpszRemoteFile
A pointer to the null-terminated string that specifies the file on the remote system that will be transferred. The file pathing and name conventions must be that of the remote host.
dwOptions
A bitmask which specifies one or more options. This parameter is constructed by using a bitwise operator with any of the following values:
Constant Description
HTTP_TRANSFER_DEFAULT The default transfer mode. The resource data is copied to the local system exactly as it is stored on the server.
HTTP_TRANSFER_CONVERT 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.
dwReserved
A reserved parameter. This value should always be zero.

Return Value

If the function succeeds, the return value is the server result code. If the function fails, the return value is HTTP_ERROR. To get extended error information, call HttpGetLastError.

Remarks

This function will cause the current thread to block until the file transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the HTTP_EVENT_PROGRESS event will be periodically fired, enabling the application to update any user interface controls. Event notification must be enabled, either by calling HttpEnableEvents, or by registering a callback function using the HttpRegisterEvent function.

To determine the current status of a file transfer while it is in progress, use the HttpGetTransferStatus function.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use cshtpav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

HttpEnableEvents, HttpGetData, HttpGetTransferStatus, HttpPostData, HttpPutData, HttpPutFile, HttpRegisterEvent


Copyright © 2008 Catalyst Development Corporation. All rights reserved.