Forum Moderators: open

Message Too Old, No Replies

Opening Text File In Text Area

         

traeanthony

3:53 am on Aug 22, 2005 (gmt 0)

10+ Year Member



I have two pages. Index.asp, and Open.aspon the index page, i have two forms: one that saves the form to a txt file which consistes of two text areas (one for the directory to save the file and the other for the file name) and text area to enter anything the user wants to enter, and another form one that needs to open the txt file and display it in the text area. So what ever was saved from the text area need to be opened and displayed back into that same text area. I've tried a couple of codes and got one that will open the saved txt file, but will only display it as an html page and doesn't redirect to index.asp and display it int he text area. does anyone know how to do this?

mrMister

10:48 am on Aug 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<%
Function fileContents(theFile)
Dim fileToWorkWith,file
fileToWorkWith = theFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f, Msg
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(fileToWorkWith, ForReading)
Set file = fso.GetFile(fileToWorkWith)

fileContents = f.Read(file.size)
End Function
%>
<html>
<head><title>title</title></head>
<body>
<form>
<textarea><%=fileContents("c:/folder/subfolder/filename.txt")%></textarea>
</form>
</body>
</html>

traeanthony

6:26 am on Aug 23, 2005 (gmt 0)

10+ Year Member



YOU ROCK! IT WORK PERFECTLY! THANK YOU SO MUCH!