| |
| INT PutFile( |
| |
LPCTSTR lpszLocalFile, |
|
| |
LPCTSTR lpszRemoteFile, |
|
| |
DWORD dwOptions |
|
| |
DWORD dwOffset |
|
| ); |
The PutFile method transfers the specified file on the
local system to the server.
Parameters
- lpszLocalFile
- A null-terminated string which specifies the file
on the local system that will be uploaded. The file pathing and
name conventions should follow Windows conventions. It is permitted
to include environment variables in the local path by surrounding
the variable with percent (%) symbols. Local file paths may also
use standard file URLs.
- lpszRemoteFile
- A null-terminated string which specifies the file
on the server that will be created, replaced or appended to on the
local system. The file naming conventions must be that of the host
operating system. It is permitted to use a URL as the remote file
name as long as the server name and port number match what was used
to establish the connection.
- dwOptions
- An unsigned integer that specifies one or more options. This
parameter may be any one of the following values:
| Value |
Description |
| FTP_TRANSFER_DEFAULT |
This option specifies the default transfer mode should
be used. If the remote file exists, it will be overwritten with
the contents of the uploaded file. |
| FTP_TRANSFER_APPEND |
This option specifies that if the remote file exists, the
contents of the local file is appended to the remote file. If
the remote file does not exist, it is created. |
- dwOffset
- A byte offset which specifies where the file transfer should
begin. The default 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 REST command to restart transfers.
Return Value
If the method succeeds, the return value is the server result
code. If the method fails, the return value is FTP_ERROR. To get
extended error information, call GetLastError.
Remarks
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 FTP_EVENT_PROGRESS event will be
periodically fired, enabling the application to update any user
interface controls. Event notification must be enabled, either by
calling EnableEvents, or by registering a callback function
using the RegisterEvent method.
To determine the current status of a file transfer while it is in
progress, use the GetTransferStatus method.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csftpv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|
|