<html>
 <head>
 <title>浏览、编辑文件</title>
 </head>
<body>
<form name="form1" method="post">
文件<input type="file" name="file1" value="查阅">
<input type="submit" value="提交">
</form>
<%
set fso = server.createobject("scripting.filesystemobject")
dim file1
path=request.form("file1")
if path<>"" then 
 session("ts")=path
 set mytxt1 =fso.opentextfile(path,1)
%>
 当前文件名：<% =fso.getfilename(path) %>
 当前文件夹：<% =fso.getparentfoldername(path) %>
 <form name="form2" action="" method="post"> 
 <textarea name="bjk" rows="9" cols="45" wrap="off">
<% 
 session("tt")=fso.getfilename(path)
 while not mytxt1.atendofstream
  response.write trim(mytxt1.readline&chr(13)) '读出文件内容
 wend
 mytxt1.close
%>
 </textarea><br>
 <input type="submit" value="提交修改">
 </form>
<%
end if
 tj=request.form("bjk")      '获取修改的内容
 if tj <>"" then 
   set mytxt2 =fso.opentextfile(session("ts"),2)
   mytxt2.write(request.form("bjk"))
   mytxt2.close 
   set myfile2=fso.getfile(session("ts"))
   path3=server.mappath("\test")
   myfile2.copy path3,true
 end if
%>
<a href="\test"><% =path3 %></a>
</body>
</html>
