SAMPLE: POSTer.exe Programmatically POSTs to the Posting Acceptor with WinInet

ID: Q244372


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) version 5


SUMMARY

POSTer.exe is a self-extracting zip file. The file contains a Microsoft Visual C++ project (an Active Template Library [ATL] control) that llustrates using the WinInet APIs to POST a file to the Microsoft Posting Acceptor. The file also contains a Visual Basic client that illustrates how to use the control.


MORE INFORMATION

If it is not possible or is not desirable to FTP files to an Internet server, it is possible to upload the files via HTTP. Two methods are available: PUT and POST. In the case of a POST request, there must be a component on the server to process the uploaded file. Microsoft provides the Posting Acceptor for this purpose. Please see the Windows NT option pack for documentation on the Posting Acceptor. This sample demonstrates POSTing a file to the Posting Acceptor using the WinInet APIs.

Typically, files are posted to the Posting Acceptor via a set of sample pages located in the scripts directory of the Web server:

Upload.asp - Will select Uploadx or Uploadn depending on the browser.
Uploadx.asp - Uses File Upload control to upload files.
Uploadn.asp - Uses generic INPUT tag (see the RFC 1867 specification).
Repost.asp - Executed on completion of upload.
Before working with this sample, make sure that you are able to POST files to your Web server via Uploadn.asp. If you have trouble, consult the Windows NT Option Pack documentation and or search the Microsoft Knowledge Base for "Posting Acceptor".

Once the Uploadn.asp process is working correctly and you are able to upload files, you should be able POST files using the FilePOSTer ATL componenet and the Visual Basic test application included with this sample. The ATL component must be registered with the Windows system using Regsvr32.exe. See the Visual Basic test application for an example of how to test the code.

Notes on the development of this component:

This sample is intended to illustrate using the WinInet APIs to upload a file via the mechanism spelled out in RFC 1867. This sample has not undergone extensive testing and does not take into account all possible configurations of Internet Information Server (IIS) and the posting acceptor. Use this component at your own risk.

In the event that the component does not function correctly, the following notes on the development of the component may be useful in diagnosing the problem:

The FilePOSTer component was developed using RFC 1867 as a guideline and by examining a network sniff of the Uploadn.asp posting a file to the file Posting Acceptor. Adjustments were made to the code in order to mimic the successful operation of the Uploadn.asp page. It was also useful to insert a DebugBreak() call into the ATL component to force the component to be loaded into the debugger when executed from the Visual Basic test application.

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:
POSTer.exe
Release Date: Oct-25-1999

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

Q179566 How to do Anonymous Uploads
Q184352 Upload files to the Internet Information Server
Q189651 Uploading a File to IIS Using a Browser

Additional query words:

Keywords : kbfile kbsample kbWinInet kbIE500 kbDSupport
Version : WINDOWS:5
Platform : WINDOWS
Issue type :


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