set fso=server.CreateObject("scripting.filesystemobject") set f1=fso.opentextfile(filename,2,true) f1.write(content) f1.close if filename1<>"" and filename1<>filename then fso.deletefile(filename1) tempurl=url&"?foldername="&fso.GetParentfoldername(filename) set fso=nothing end if response.Redirect(tempurl) end function function filenew() filename=request.QueryString("filename") content="" fileform filename,content,filename1 end function function fileedit() filename=request.QueryString("filename") filename1=request.QueryString("filename") set fso=server.CreateObject("scripting.filesystemobject") set f1=fso.opentextfile(filename,1,true) content=server.HTMLEncode(f1.readall) f1.close set fso=nothing fileform filename,content,filename1 end function function fileform(filename,content,filename1) %> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <form name="form1" method="post" action="<%= url%>?action=savefile"> <tr> <td><input name="filename1" type="hidden" value="<%= filename1%>"><input name="filename" type="text" value="<%= filename%>" style="width:100%"></td> </tr> <tr> <td><textarea name="content" wrap="VIRTUAL" style="width:100%;height:100%;font:Arial,Helvetica,sans-serif;" onKeyUp="style.height=this.scrollHeight;"><%= content%></textarea></td> </tr> <tr> <td><center><input type="submit" name="Submit" value="保存" style="width:200"><input type="reset" name="Submit2" value="重置" style="width:200"></center></td> </tr> </form> </table> <% end function |