欢迎光临
我们一直在努力

这里有一个例子 文件的读出 编辑 管理

建站超值云服务器,限时71元/月

<%
urlpath="http://"&request.servervariables("server_name")
dim cpath,lpath
set fsobrowse=createobject("scripting.filesystemobject")
if request("path")="" then
lpath="/"
else
lpath=request("path")&"/"
end if
if request("attrib")="true" then
cpath=lpath
attrib="true"
else
cpath=server.mappath(lpath)
attrib=""
end if
sub getfolder()
dim thefolder,thesubfolders
if fsobrowse.folderexists(cpath)then
set thefolder=fsobrowse.getfolder(cpath)
set thesubfolders=thefolder.subfolders
response.write"<a href=list.asp?path="&request("oldpath")&"&attrib="&attrib&"><font color=#ff8000>■</font>↑<font color=ff2222>回上级目录</font></a><br>"
response.write"<table border=0 width=100% cellpadding=0>"
for each x in thesubfolders
response.write"<tr><td width=50%><a href=list.asp?path="&lpath&x.name&"&oldpath="&request("path")&"&attrib="&attrib&">└<font color=#ff8000>■</font>  "&x.name&"</a> </td>"
response.write "<td><a href=# onclick=javascript:window.open(delete.asp?spath=" & server.urlencode(lpath) & "" & server.urlencode(x.name) & "&aim=floders,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font color=#ff8000 >×</font>删除</a></td>"
response.write "<td><a href=# onclick=javascript:window.open(move.asp?spath=" & server.urlencode(lpath) & "" & server.urlencode(x.name) & "&aim=floders,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font color=#ff8000 >×</font>移改</a></td>"
response.write "<td><a href=# onclick=javascript:window.open(copy.asp?spath=" & server.urlencode(lpath) & "" & server.urlencode(x.name) & "&aim=floders,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font color=#ff8000 >×</font>复制</a><br></td></tr>"
next
response.write "</table>"
end if
end sub

sub getfile()
dim thefiles
if fsobrowse.folderexists(cpath)then
set thefolder=fsobrowse.getfolder(cpath)
set thefiles=thefolder.files
response.write"<table border=0 width=100% cellpadding=0>"
for each x in thefiles
if request("attrib")="true" then
showstring="<strong>"&x.name&"</strong>"
else
showstring="<a href=# onclick=javascript:window.open("&urlpath&lpath&server.urlencode(x.name)&",hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><strong>"&x.name&"</strong></a>"
end if
if right(x.name,4)=".exe" or right(x.name,4)=".exe" then
showstring=showstring&"</td><td width=10%><a href=# onclick=javascript:window.open(fileop.asp?filename="&lpath&x.name&"&action=execute,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font color=red>执行</font></a></td>"
else
showstring=showstring&"</td><td width=10%></td>"
end if
response.write"<tr><td width=20%><font color=#ff8000>□</font>"&showstring&"<td width=15% align=right>"&x.size&"字节</td><td width=45%><a href=# title="&"类型:"&x.type&chr(10)&"属性:"&x.attributes&chr(10)&"时间:"&x.datelastmodified&"><font color=#ff8000 >?</font>属性</a><a href=# onclick=javascript:window.open(view.asp?path="&server.urlencode(lpath)&server.urlencode(x.name)&"&attrib="&attrib&",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="&server.urlencode(lpath)&server.urlencode(x.name)&"&attrib="&attrib&",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="&server.urlencode(lpath)&server.urlencode(x.name)&"&op=del&attrib="&attrib&",hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font color=#ff8000 >×</font>删除</a><a href=# onclick=javascript:window.open(copy.asp?spath=" & server.urlencode(lpath) & "" & server.urlencode(x.name) & "&aim=files,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font  color=#ff8000 >+</font>复制</a><a href=# onclick=javascript:window.open(move.asp?spath="&server.urlencode(lpath)&server.urlencode(x.name)&"&aim=files"&",hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);><font  color=#ff8000 >+</font>移动</a></td></tr>"
next
end if
response.write"</table>"
end sub
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title></title>
<meta name="generator" content="microsoft frontpage 3.0">
<style>
<!–
table{ font-family: 宋体; font-size: 9pt }
a{ font-family: 宋体; font-size: 9pt; color: rgb(0,32,64); text-decoration: none }
a:hover{ font-family: 宋体; color: rgb(255,0,0); text-decoration: none }
a:visited{ color: rgb(128,0,0) }
–>
</style>
</head>
<script language="javascript">
function crfile(ls)
{if (ls==""){alert("请输入文件名!");}
else {window.open(edit.asp?attrib=<%=request("attrib")%>&creat=yes&path=<%=lpath%>+ls,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);}
return false;
}
function crdir(ls)
{if (ls==""){alert("请输入文件名!");}
else {window.open(edir.asp?attrib=<%=request("attrib")%>&op=creat&path=<%=lpath%>+ls,hyne_love_achye,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400);}
return false;
}
</script>
<script language="vbscript">
sub rmdir(ls)
if confirm("你真的要删除这个目录吗!"&chr(13)&chr(10)&"目录为:"&ls)   then
window.open("edir.asp?path="&ls&"&op=del&attrib=<%=request("attrib")%>")
end if
end sub
sub copyfile(sfile)
dfile=inputbox("※文件复制※"&chr(13)&chr(10)&"源文件:"&sfile&chr(13)&chr(10)&"输入目标文件的文件名:"&chr(13)&chr(10)&"[允许带路径,要根据你的当前路径模式]")
dfile=trim(dfile)
attrib="<%=request("attrib")%>"
if dfile<>"" then
if instr(dfile,":") or instr(dfile,"/")=1 then
lp=""
if instr(dfile,":") and attrib<>"true" then
alert "对不起,你在相对路径模式下不能使用绝对路径"&chr(13)&chr(10)&"错误路径:["&dfile&"]"
exit sub
end if
else
lp="<%=lpath%>"
end if
window.open("edit.asp?path="+sfile+"&op=copy&attrib="+attrib+"&dpath="+lp+dfile)
else
alert"您没有输入文件名!"
end if
end sub
</script>
<body>
<table border="1" width="100%" cellpadding="0" height="81" bordercolorlight="#000000"
bordercolordark="#ffffff" cellspacing="0">

  <tr>
    <td width="100%" bgcolor="#c0c0c0" colspan="2">※切换到相应盘符:<span
    style="background-color: rgb(255,255,255);color:rgb(255,0,0)"><%
for each thing in fsobrowse.drives
response.write "◎<a href=list.asp?path="&thing.driveletter&":&attrib=true>"&thing.driveletter&":</a>"
next
%> </span><br>
    [如果该盘在服务器上不存在,那么将不显示东西,你也可以更url上的path值换换到其它路径上,支持局域网地址,如:"\\pc01\c"]</td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#c0c0c0" colspan="2">※<%
if request("attrib")="true"  then
response.write "<a href=list.asp>切换到相对路径编辑模式</a>"
else
response.write "<a href=list.asp?attrib=true>切换到绝对路径编辑模式</a>"
end if
%>  ※绝对路径:<span
    style="background-color: rgb(255,255,255)"><%=cpath%></span></td>
  </tr>
  <tr>
<td width="100%" bgcolor="#c0c0c0" colspan="2">※当前目录<font color="#ff8000">■</font>:<span style="background-color: rgb(255,255,255)"><%=lpath%></span> <br>
※上传文件到当前目录<font color="#ff8000">■</font>:<span style="background-color: rgb(255,255,255)"><a href=../upfilein.asp?filepath=<%=server.urlencode(cpath)%> target=_blank>上传文件(文件大小最好不要超过500k)</a></span>
</td>
  </tr><form name="newfile"
    onsubmit="return crfile(newfile.filename.value);">
  <tr><td bgcolor="#c0c0c0" colspan="2">〖文件〗 注:只允许文本编辑|<input type="text" name="filename" size="20"><input
      type="submit" value="新建文件"><input type="button" value="新建目录" onclick="crdir(newfile.filename.value)">
   </td>
  </tr></form>
  <tr>
    <td width="40%" valign="top" bgcolor="#c8e3ff"><%call getfolder()%>
</td>
    <td width="60%" valign="top" bgcolor="#ffefdf"><%call getfile()%>
</td>
  </tr>
</table>

</body>
</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 这里有一个例子 文件的读出 编辑 管理
分享到: 更多 (0)