| |
| INT WINAPI HttpPutFile(
|
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszLocalFile, |
|
| |
LPCTSTR lpszRemoteFile, |
|
| |
DWORD dwOptions |
|
| |
DWORD dwOffset |
|
| );
|
The HttpPutFile function transfers the specified file on
the local system to the server.
Parameters
- hClient
- Handle to the client session.
- lpszLocalFile
- A pointer to a null-terminated string that specifies the file
that will be transferred from the local system. The file pathing
and name conventions must be that of the local system.
- lpszRemoteFile
- A pointer to a null-terminated string that specifies the file
on the server that will be created, overwritten or appended to.
This string may specify a valid URL for the current server that the
client is connected to.
- dwOptions
- An unsigned integer that specifies one or more options. This
parameter may be any one of the following values:
| Constant |
Description |
| HTTP_TRANSFER_DEFAULT |
This option specifies that the default transfer mode should be
used. If the remote file exists, it will be overwritten with the
contents of the uploaded file. |
- dwOffset
- 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 open the file, otherwise this function
will fail.
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
The HttpPutFile function is used to transfer a file from
the local system to a server. Not all servers permit files to be
uploaded and some may require that specific configuration changes
be made to the server in order to support this functionality.
Consult your server's technical reference documentation to see if
it supports the PUT command, and if so, what must be done to enable
it. It may be required that the client authenticate itself using
the HttpAuthenticate function prior to uploading the
file.
To upload large files that are over 4GB, use the
HttpPutFileEx function.
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 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use cshtpav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
HttpEnableEvents, HttpGetFile, HttpGetTransferStatus, HttpPostData, HttpPostFile, HttpPutData, HttpPutFileEx, HttpRegisterEvent
|
|