Compartir a través de


CFtpConnection::PutFile

Call this member function to store a file on an FTP server.

BOOL PutFile(
   LPCTSTR pstrLocalFile,
   LPCTSTR pstrRemoteFile,
   DWORD dwFlags = FTP_TRANSFER_TYPE_BINARY,
   DWORD_PTR dwContext = 1 
);

Parameters

  • pstrLocalFile
    A pointer to a string containing the name of the file to send from the local system.

  • pstrRemoteFile
    A pointer to a string containing the name of the file to create on the FTP server.

  • dwFlags
    Specifies the conditions under which the transfer of the file occurs. Can be any of the FTP_TRANSFER_* constants described in OpenFile.

  • dwContext
    The context identifier for placing the file. See Remarks for more information about dwContext.

Return Value

Nonzero if successful; otherwise 0. If the call fails, the Win32 function GetLastError may be called to determine the cause of the error.

Remarks

PutFile is a high-level routine that handles all of the operations associated with storing a file on an FTP server. Applications that only send data, or that require closer control over the file transfer, should use OpenFile and CInternetFile::Write.

Override the dwContext default to set the context identifier to a value of your choosing. The context identifier is associated with this specific operation of the CFtpConnection object created by its CInternetSession object. The value is returned to CInternetSession::OnStatusCallback to provide status on the operation with which it is identified. See the article Internet First Steps: WinInet for more information about the context identifier.

Requirements

Header: afxinet.h

See Also

Concepts

CFtpConnection Class

CFtpConnection Members

Hierarchy Chart

CInternetConnection Class