Microsoft KB Archive/244372

From BetaArchive Wiki
Knowledge Base


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

Article ID: 244372

Article Last Modified on 8/5/2004



APPLIES TO

  • Microsoft Internet Explorer 5.0
  • Microsoft Windows Internet Services (WinInet)



This article was previously published under Q244372

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:

Release Date: Oct-25-1999

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

REFERENCES

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

179566 How to do Anonymous Uploads


184352 Upload files to the Internet Information Server


189651 Uploading a File to IIS Using a Browser



Additional query words: POSTer

Keywords: kbdownload kbfile kbsample KB244372