PDA

Click to See Complete Forum and Search --> : Opening a text file (VBscript)


rino_2
Jul 3rd, 2000, 04:54 PM
Hi,

Is it possible to open up a text file and then have it displayed in a HTML <TEXTAREA>? If so how? Also, if that is possible, how would I save it after changes have taken place? Thanks

Clunietp
Jul 4th, 2000, 12:35 AM
here ya go, read a text file into a textarea:


<TEXTAREA>
<%

dim fso
dim objTxtStream
dim strText

set fso = server.CreateObject("Scripting.FileSystemObject")

set objTxtStream = fso.OpenTextFile("c:\inetpub\wwwroot\myfile.txt", 1)
strText = objtxtstream.ReadAll
Response.Write strtext

set fso = nothing
set objTxtStream = nothing


%>
</TEXTAREA>


after you submit the form, get the value, and use objTxtStream.Write method to rewrite the file

check out the scripting runtime help for more info

Tom