Forum Moderators: open
Here is my save.asp script:
[b]<%
Dim objFSO, objFile, data
data = Request.Form("data")
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("test.txt", ForWriting)
objFile.Write data
objFile.Close
SET objFSO = NOTHING
SET data = NOTHING
SET objFile = NOTHING
%>
[/b] and here is my write.asp script:
[b]<%
Dim objFSO, objFile, data, objReadFile, strContents
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("test.txt")
If objFile.Size > 0 Then
Set objReadFile = objFSO.OpenTextFile("test.txt", 1)
strContents = objReadFile.ReadAll
response.write strContents
objReadFile.Close
Else
response.write "The file is empty."
End If
%>
<FORM ACTION="save.asp" METHOD="POST" TITLE="form">
<TEXTAREA NAME="data" ROWS="10" COLS="50">
</TEXTAREA>
<BR>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
[/b] the write.asp shows whats on the page, and has a text area to write and save the new text. Comments or suggestions is greatly apreciated. And if anyone has a script for writing to a text file using .php or perl I would greatly apreciate an idea on how to do that. Thanks.
~Isaac Lloyd~
p.s. the [ code ] thing isn't working so my script is in BOLD.