Stores a file on the FTP server.
Syntax
BOOL FtpPutFile( IN HINTERNET hConnect, IN LPCTSTR lpszLocalFile, IN LPCTSTR lpszNewRemoteFile, IN DWORD dwFlags, IN DWORD_PTR dwContext );The actual syntax of this function varies between its ANSI and Unicode implementations. For more information, see Win32 Internet Functions Syntax.
Parameters
- hConnect
- Valid HINTERNET handle to an FTP session.
- lpszLocalFile
- Address of a null-terminated string that contains the name of the file to send from the local system.
- lpszNewRemoteFile
- Address of a null-terminated string that contains the name of the file to create on the remote system.
- dwFlags
- Unsigned long integer value that contains the conditions under which the transfers occur. The application should select one transfer type and any of the flags that control how the caching of the file will be controlled. The transfer type can be any one of the following values:
- FTP_TRANSFER_TYPE_ASCII
- Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
- FTP_TRANSFER_TYPE_BINARY
- Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists, with no changes. This is the default transfer method.
- FTP_TRANSFER_TYPE_UNKNOWN
- Defaults to FTP_TRANSFER_TYPE_BINARY.
- INTERNET_FLAG_TRANSFER_ASCII
- Transfers the file as ASCII.
- INTERNET_FLAG_TRANSFER_BINARY
- Transfers the file as binary.
The following values are used to control the caching of the file. The application can use one or more of the following values:
- dwContext
- Address of an unsigned long integer value that contains the application-defined value that associates this search with any application data. This parameter is used only if the application has already called InternetSetStatusCallback to set up a status callback.
Return Value
Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.
Remarks
FtpPutFile is a high-level routine that handles all the bookkeeping and overhead associated with reading a file locally and storing it on an FTP server. An application that needs to send file data only, or that requires close control over the file transfer, should use the FtpOpenFile and InternetWriteFile functions.
If the dwFlags parameter specifies FILE_TRANSFER_TYPE_ASCII, translation of the file data converts control and formatting characters to local equivalents.
Both lpszNewRemoteFile and lpszLocalFile can be either partially or fully qualified file names relative to the current directory.
Function Information
Windows NT Use version 4.0. Implemented as ANSI and Unicode functions. Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions. Header Wininet.h Import library Wininet.lib Minimum availability Internet Explorer 3.0 (ANSI only), 5 (ANSI and Unicode)
Windows CE
Windows CE Use version 2.12 and later. Implemented as ANSI and Unicode functions. Minimum availability Internet Explorer 4.0
See Also
Microsoft Win32 Internet Functions Overview, FTP Sessions, Microsoft Win32 Internet Functions Reference, FTP Functions