www.gusucode.com > 因特达Access数据库在线管理系统 > 因特达Access数据库在线管理系统\code\access\file_list_right.asp

    
<!-- #include file="conn.asp" -->
<!-- #include file= "public.asp" -->
<!--#include file = "session.asp"-->
<!doctype html public "-//w3c//dtd html 4.0 strict//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文件预览区</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 13px;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #0033CC;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #0033CC;
}
a:hover {
	text-decoration: underline;
	color: #FF0000;
}
a:active {
	text-decoration: none;
	color: #FF0000;
}
.b1 {
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-right-style: solid;
	border-bottom-style: solid;
	border-right-color: #D0D0BF;
	border-bottom-color: #D0D0BF;
	border-top-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-left-style: solid;
	border-top-color: #FFFFFF;
	border-left-color: #FFFFFF;
}
#r {
	text-align: right;
	padding-right:8px;
}
.STYLE1 {border-right-width: 1px; border-bottom-width: 1px; border-right-style: solid; border-bottom-style: solid; border-right-color: #D0D0BF; border-bottom-color: #D0D0BF; border-top-width: 1px; border-left-width: 1px; border-top-style: solid; border-left-style: solid; border-top-color: #FFFFFF; border-left-color: #FFFFFF; font-weight: bold; }
-->
</style>
<script>parent.document.all.upfile_frame.src='file_upfile.asp?savepath=<%=request("path")%>'</script>
<script  language="JScript.Encode" src="js/file_list_right.js"></script>
</head>
<% 
dim userPath'用于确定用户只能放问的目录
dim requestPath'返回的请求路径
userPath="document/com/"&session("公司简称")&"/"&session("username")
requestPath=request("path")
'	response.Write(request("path"))
'	response.end()
if requestPath="/" then requestPath=""
requestPath=replace(requestPath,"\","/")'
requestPath=replace(requestPath,"../","")'不让访问上级目录
requestPath=replace(requestPath,"u:/","")'
requestPath=replace(requestPath,"u:","")'

path=userPath&"/"&requestPath
if path="" then 
	response.Write("无路径")
	response.end()
end if
%>
<body onclick="body_click('<%=requestPath%>','<%="document/com/"&session("公司简称")&"/"&session("userName")%>')" >

<TABLE width=100% cellpadding="3" cellspacing="0"><tr bgcolor="#ECE9D8">
  <td height="20" colspan="2" class="STYLE1">
  文件名
  <td width="11%" align="right" class="b1"><strong>文件大小
  </strong>
  <td width="20%" class="STYLE1">最后修改时间  </td>
  <td width="32%" class="STYLE1">操作</td>
</tr>

<%'以下是列出文件
url = Server.MapPath(path)
'response.Write(path)
'response.End()
'response.write(url)
Set fso = CreateObject("Scripting.FileSystemObject")
Set theCurrentFolder = fso.GetFolder(url) 
Set curFiles = theCurrentFolder.Files 

i=0
on error resume next
For Each fileItem in curFiles
	fname = fileItem.Name
	delfile(fname)'删除asp文件
	arr=split(fname,".")
	houName=arr(ubound(arr))
	
	img="images/"&houName&".gif"
	if not fso.fileexists(server.mappath(img)) then
		img="images/unknown.gif"
	end if
	file_size=FormatNumber(fileItem.size/1024,0,-1)&"KB"
	if  fileItem.size<1024 then
		file_size=fileItem.size&"字节"
	end if
	
	if  fileItem.size>1024*1024 then
		file_size=FormatNumber(fileItem.size/(1024*1024),0,-1)&"M"
	end if
	
	
	select case lcase(houName)'用后缀名查看是否可编辑
		case "htm","html","txt","rtf"
			edit_a="<a href=#e>编辑</a>"
		case else
			edit_a="编辑"
	end select
%><tr onMouseover=this.bgColor='#F0F0F0' onMouseout=this.bgColor=''><td width="1%"><img src=<%=img%>></td><TD width="36%"><a href=#f><%=fname%></a><TD id=r><%= file_size %><td><%=fileItem.datelastmodified%><td><%=edit_a%> <a href=#r>更名</a> <a href=#d>下载</a> <a href=#d>删除</a><%
i=i+1
next
if i<1 then '没有数据
	response.write("<table width='100%'><tr><td align='center'><br><br><br><font color=#ff0000>没有找到文件</font></td></tr></table>")
end if

%>
  <td>  
</TABLE>
<iframe name="blank" width="0" height="0"></iframe>
</body>
</html>

<%
function delFile(fileName)
	file_name=lcase(fileName)
	if file_name="globla.asa" then exit function
	if right(file_name,4)=".asp"or right(file_name,4)=".asa" or right(file_name,4)=".php" then
		set obj_fso=server.createobject("scripting.filesystemobject")
		full_path=url&"/"&fileName'url全局
		'response.write
		obj_fso.deletefile(full_path)
	end if
end function
%>