Microsoft KB Archive/300469

From BetaArchive Wiki

Article ID: 300469

Article Last Modified on 9/7/2004



APPLIES TO

  • Microsoft ActiveX Data Objects 2.5, when used with:
    • Microsoft Windows 2000 Standard Edition
    • Microsoft Windows NT 4.0
  • Microsoft ActiveX Data Objects 2.6, when used with:
    • Microsoft Windows 2000 Standard Edition
    • Microsoft Windows NT 4.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0



This article was previously published under Q300469


SUMMARY

This article demonstrates how to use Internet Publishing Provider to upload files.

How to Use the Internet Publishing Provider to Upload Files

  1. Open Internet Services Manager. To open Internet Services Manager on a computer that is running Microsoft Windows 2000, follow these steps:
    1. From the Windows Start menu, point to Programs, and point to Administrative Tools.
    2. Click Internet Services Manager to open the Internet Services Manager (ISM) console on your Web server.

    To open Internet Service Manager on a computer that is running Microsoft Windows NT 4.0, follow these steps:

    1. From the Windows Start menu, point to Programs, point to Windows NT 4.0 Option Pack, and then click Microsoft Internet Information Server.
    2. Click Internet Service Manager.
  2. In Internet Services Manager, right-click the default Web site, point to New, and then click Virtual Directory. Name the new virtual directory Upload. Complete the steps in the wizard to set up the new virtual directory.
  3. In Visual Basic, create a new Standard EXE project. Form1 is added to the project by default.
  4. From the Project menu, click References, select the Microsoft ActiveX Data Objects 2.6 check box.
  5. Paste the following code onto the Declarations section of Form1:

    Option Explicit
    Private Sub Form_Load()
        Dim objStream As ADODB.Stream
        Dim objRecord As ADODB.Record
        Dim strUrl As String, strFile As String
        strUrl = "http://local/Upload"
        strFile = "test2.txt"
        Set objRecord = New ADODB.Record
        Set objStream = New ADODB.Stream
        objRecord.Open strFile, "URL=" + strUrl, adModeReadWrite, _
           adCreateOverwrite, adDelayFetchStream
        objStream.Type = adTypeBinary
        objStream.Open objRecord, adModeReadWrite, adOpenStreamFromRecord
        objStream.LoadFromFile "C:\test.txt"
        objStream.Flush
        objStream.Close
        objRecord.Close
        Set objStream = Nothing
        Set objRecord = Nothing
    End Sub
                        
  6. Change the value of strURL to the appropriate Web site URL.
  7. Press the F5 key to run the project.
  8. Open the Internet Information Services console again, and look in the Upload virtual directory. Notice your file has been uploaded.

back to the top

Keywords: kbhowto kbhowtomaster KB300469