"Ketta" <no@post.net> wrote in message
news:OH*************@tk2msftngp13.phx.gbl...
Well thanks for that part, that will definately help me. But I still do
not have the file in a textbox. It just outputs it to the screen. This is my
code for reading the file and putting it on the screen. I'm a total noob
with ASP btw. This is probably just annoying to have someone like me
asking for help.
If I were annoyed, I wouldn't use newsgroups. :]
Now all I need is the code below to output to a textbox....
somehow.
<%
set fso = server.createobject("Scripting.FileSystemObject")
set fs = fso.openTextFile("textfile.txt",1,true)
response.write replace(replace(fs.readall,"<","<"),vbCrLf,"<br>")
fs.close: set fs = nothing: set fso = nothing
%>
You can just server.execute the contents of the file, i.e.
http://yoursite/filemod.asp?filename=file.txt :
<%
sFilename = Request.Querystring("filename")
%>
<html>
<form method="post" action="filemodp.asp">
<input name="filename" value="<%=sFilename%>" type="hidden">
<textarea name="fileContents" style="width: 500px; height: 800px;"><%
Server.Execute sFilename %></textarea>
<input type="submit">
</form>
http://yoursite/filemodp.asp :
<%
Dim sFilename, sContents
sFilename = Request.Form("filename")
sContents = Request.Form("fileContents")
If sFilename <> "" Then
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.CreateTextFile(Server.MapPath(sFilename), True)
oFile.Write sContents
oFile.Close
Set oFile = Nothing
Set oFSO = Nothing
End If
Response.Redirect "filemod.asp?filename=" & sFilename
%>
Play around with that to see what I mean. But, what you'll want to do first
is create a file named "file.txt" throw a few characters into it, and then
load up the filemod.asp page with the ?filename=file.txt querystring. This
sample has no handling of errors for empty or non-existant files.
Ray at work