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
- Open Internet Services Manager. To open Internet Services Manager on a computer that is running Microsoft Windows 2000, follow these steps:
- From the Windows Start menu, point to Programs, and point to Administrative Tools.
- 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:
- From the Windows Start menu, point to Programs, point to Windows NT 4.0 Option Pack, and then click Microsoft Internet Information Server.
- Click Internet Service Manager.
- 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.
- In Visual Basic, create a new Standard EXE project. Form1 is added to the project by default.
- From the Project menu, click References, select the Microsoft ActiveX Data Objects 2.6 check box.
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
- Change the value of strURL to the appropriate Web site URL.
- Press the F5 key to run the project.
- Open the Internet Information Services console again, and look in the Upload virtual directory. Notice your file has been uploaded.
Keywords: kbhowto kbhowtomaster KB300469