INFO: FTP Append Functionality not Available from WinInet

ID: Q182316


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) versions 3.02, 4.01, 5


SUMMARY

The Win32 Internet Extensions, or WinInet (WinInet.dll), do not directly implement functionality to enable FTP appends.


MORE INFORMATION

WinInet provides access to common Internet protocols, including Gopher, FTP, and HTTP. Using WinInet, you can write Internet client applications at a higher level of programming, without having to deal with WinSock, TCP/IP, or the details of specific Internet protocols.

FTP commonly exposes an "append" command to append one file to another. WinInet does not directly expose this functionality.

In Internet Explorer 3.0 and 4.0, the workaround for this problem is to download the file from the server, append to it on the client then upload the file back to the server.

Beginning with Internet Explorer 5, FTP commands can be sent directly to the FTP server using the FtpCommand as follows:


CHAR szTemp[256];
wsprintf (szTemp, "APPE %s", "DestFile.txt");

bRet = FtpCommand( hConnection,// WinInet Connection handle
TRUE,// Yes, I expect a response
FTP_TRANSFER_TYPE_ASCII,// I'm receiving ASCII
szTemp,// This is the FTP command I am passing
0,// No context needed
&hResponse);// The handle to read the response 
if (!bRet)
{
cout << "FtpCommand failed, error: " << GetLastError() << endl;
return;
}

wsprintf (szTemp, "This data will be appended to the file");

DWORD dwSize;
if (!InternetWriteFile (hResponse, (LPVOID)szTemp, lstrlen(szTemp)+1, &dwSize))
{
cout << "InternetWriteFile failed, error: " << GetLastError() << endl;
return;
} 
For additional information on the use of the FtpCommand function, click the article number below to view the article in the Microsoft Knowledge Base:
Q238273 SAMPLE: Ftpcmd.exe WinInet FtpCommand() Function Sample
An alternative to either of these approaches would be to use Winsock to directly communicate with the FTP server.


REFERENCES

For additional information on other limitations of the WinInet FTP functions, click the article number below to view the article in the Microsoft Knowledge Base:

Q172712 INFO: Limitations of WinInet FTP Functions
For more information, please see the following topics on the Microsoft Developer Network (MSDN) Library:
  • Microsoft Internet Client SDK
  • Microsoft Platform SDK

Additional query words: kbdsi kbwininet kbftp

Keywords : kbIE400 kbWinInet kbIE500 kbDSupport
Version : WINDOWS:3.02,4.01,5
Platform : WINDOWS
Issue type :


Last Reviewed: January 11, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.