How To Use Internet Publishing Provider to Upload Files in Windows XP (305724)
The information in this article applies to:
- ActiveX Data Objects (ADO) 2.5, when used with:
- the operating system: Microsoft Windows XP
- ActiveX Data Objects (ADO) 2.6, when used with:
- the operating system: Microsoft Windows XP
This article was previously published under Q305724
"Formal product support for Microsoft Windows XP will be available from Microsoft beginning October 25, 2001. Until then, you can consult with your counterparts, peers, and Microsoft Most Valuable Professionals (MVPs) by using our online newsgroups. Access to the Microsoft newsgroups is available from the following Microsoft Web site:
" SUMMARY
This article demonstrates how to use Internet Publishing Provider to upload files.
back to the top
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 XP, 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.
- 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 Microsoft Visual Basic, create a new Standard EXE project. Form1 is added to the project by default.
- From the Project menu, click References, and 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
- In the preceding code, 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 that your file has been uploaded.
back to the top
Modification Type: | Major | Last Reviewed: | 9/13/2006 |
---|
Keywords: | kbhowto kbHOWTOmaster KB305724 kbAudDeveloper kbAudITPro |
---|
|