Results 1 to 2 of 2

Thread: Opening a text file (VBscript)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Talking

    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
    rino_2
    Visual Basic, HTML
    Please Visit my Site: Richard's VB Site

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    here ya go, read a text file into a textarea:

    Code:
    <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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width