CFtpClient::PutData Method  
 
INT PutData(
  LPCTSTR lpszRemoteFile,  
  LPBYTE lpBuffer,  
  DWORD dwLength  
);
INT PutData(
  LPCTSTR lpszRemoteFile,  
  LPCTSTR lpszBuffer  
);

The PutData method transfers the contents of the specified buffer to a file on the server.

Parameters

lpszRemoteFile
A pointer to a string that specifies the file on the server that will be created, overwritten or appended to. The file naming conventions must be that of the host operating system.
lpBuffer
A pointer to the data that will be copied to the server and stored in the specified file. An alternate version of the method uses a pointer to a string buffer where all of the bytes will be written to the server up to, but not including, the terminating null character.
dwLength
The number of bytes to copy from the buffer.

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: cstools11.h
Import Library: csftpv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

ChangeDirectory, EnableEvents, GetData, GetFile, GetTransferStatus, PutFile, RegisterEvent, SetBufferSize