PDA

Click to See Complete Forum and Search --> : Reading a txt file into a html page using vb script


neoknight
Oct 3rd, 2000, 07:11 AM
Could someone please help me in trying to read information from a text file into a web page (text box on a form).
AS i've tried everything and can't find out how. An example page would be greatly appreciated.

Ianpbaker
Oct 3rd, 2000, 08:03 AM
hi neoknight

4guysfromrolla has a good description on how to do what you ask.

check out http://www.4guysfromrolla.com/webtech/040699-1.shtml

hope this helps

Ian

Mark Sreeves
Oct 3rd, 2000, 08:12 AM
I just read that link as well Ian!

but I knocked-up a complete example...

<%@ Language=VBScript %>
<%option explicit%>
<HTML>

<BODY>
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f,myText

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile("c:\testfile.txt", ForReading, True)

Do While not f.AtEndOfStream
myText = myText & f.ReadLine & vbCrLf
Loop


f.Close

Response.Write("<input value='" & mytext & "'>")
%>

</BODY>
</HTML>

Ianpbaker
Oct 3rd, 2000, 08:18 AM
cheers mark, it's just that I didn't have enough time to do it myself.

Ian