% 'This file displays the "file open" page when first called and
'displays the contents of the file to be edited when invoked
'from the "file open" page
Response.Buffer=true
dim fp, fileSys, txtFile, filePath
dim strContent, FileName, crlf
crlf = chr(13) & chr(10)
strContent=""
FileName = Request.form("fileName")
fp = "c:\courses\webprog\aspsamps\TextEdit\"
filePath = fp & fileName
if FileName = "" then 'if no file specified or 1st call
'then send open file page %>
Open Text File
Open Text File
<%else 'load page displaying file for update/edit
%>
The mini text editor
My mini text editor
<%end if
dim EditText
Set fileSys = CreateObject("Scripting.FileSystemObject")
if fileSys.FileExists(filePath) then
set txtFile=fileSys.OpenTextFile(filePath, 1, 0)
'Create javascript block for js to write text lines to textarea
Response.Write("" & crlf)
txtFile.close
else 'if file does not exist do nothing since textarea
'will reamin blank and Save will create a file.
end if
%>