文件管理
来源:互联网 发布:人工智能利好政策来了 编辑:程序博客网 时间:2024/04/29 20:17
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 80/60){
if(image.width>80){
ImgD.width=80;
ImgD.height=(image.height*80)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>60){
ImgD.height=60;
ImgD.width=(image.width*60)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<%
Const FsoString="Scripting.FileSystemObject" 'FSO字符串
Dim Sfor(30,2)
Dim objFSO,Uploadpath,FileName
Dim Folder
Dim Num,FileCount
If Request("Path")<>"" Then
UploadPath=Request("Path")
Else
UploadPath="../UpLoadFile"
End If
sFor(0,0)="txt":sFor(0,1)="txt"
sFor(1,0)="chm":sFor(1,1)="chm"
sFor(2,0)="hlp":sFor(2,1)="chm"
sFor(3,0)="doc":sFor(3,1)="doc"
sFor(4,0)="pdf":sFor(4,1)="pdf"
sFor(5,0)="gif":sFor(5,1)="gif"
sFor(6,0)="jpg":sFor(6,1)="jpg"
sFor(7,0)="png":sFor(7,1)="png"
sFor(8,0)="bmp":sFor(8,1)="bmp"
sFor(9,0)="asp":sFor(9,1)="asp"
sFor(10,0)="jsp":sFor(10,1)="asp"
sFor(11,0)="js" :sFor(11,1)="asp"
sFor(12,0)="htm":sFor(12,1)="html"
sFor(13,0)="html":sFor(13,1)="html"
sFor(14,0)="shtml":sFor(14,1)="html"
sFor(15,0)="zip":sFor(15,1)="zip"
sFor(16,0)="rar":sFor(16,1)="rar"
sFor(17,0)="exe":sFor(17,1)="exe"
sFor(18,0)="avi":sFor(18,1)="avi"
sFor(19,0)="mpg":sFor(19,1)="mpg"
sFor(20,0)="ra" :sFor(20,1)="ra"
sFor(21,0)="ram":sFor(21,1)="ra"
sFor(22,0)="mid":sFor(22,1)="mid"
sFor(23,0)="wav":sFor(23,1)="wav"
sFor(24,0)="mp3":sFor(24,1)="mp3"
sFor(25,0)="asf":sFor(25,1)="asf"
sFor(26,0)="php":sFor(26,1)="aspx"
sFor(27,0)="php3":sFor(27,1)="aspx"
sFor(28,0)="aspx":sFor(28,1)="aspx"
sFor(29,0)="xls":sFor(29,1)="xls"
sFor(30,0)="mdb":sFor(30,1)="mdb"
'得到文件类型
Function Procgetformat(Sname)
Dim I,Str
Procgetformat=0
If Instrrev(Sname,".")=0 Then Exit Function
Str=Lcase(Mid(Sname,Instrrev(Sname,".")+1))
For I=0 To Ubound(Sfor,1)
If Str=Sfor(I,0) Then
Procgetformat=Sfor(I,1)
Exit For
End If
Next
End Function
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="cnkbox">
<tr colspan="2">
<td colspan="6" align="center" class="title">文 件 管 理</td>
</tr>
<tr>
<td width="100" height="30" align="left" class="bk">
<select name="path" class="input" onChange="MM_jumpMenu('self',this,0)">
<option value="?path=../UpLoadFile">请选择文件</option>
<option value="?path=../UpLoadFile">普通上传文件</option>
<option value="?path=Editor/UploadFile">编辑器上传文件</option>
</select></td>
<td colspan="3" align="center" class="bk">
当前浏览 <font style="color:#666666;font-weight:bold"><%=server.mappath(uploadpath)%></font> 目录的所有文件列表如下
</td>
<td align="center" class="bk"> </td>
<td align="center" class="bk"> </td>
</tr>
<tr>
<td align="center" class="bk">类型</td>
<td align="center" class="bk">缩览图</td>
<td align="center" class="bk">文件名称</td>
<td align="center" class="bk">大小</td>
<td align="center" class="bk">上传日期</td>
<td align="center" class="bk">删除</td>
</tr>
<%
On Error Resume Next
Set objFSO=Server.CreateObject(FsoString)
If Err.Number=-2147221005 Then
Response.Write "<Tr><Td Colspan=6 Class=bk align='center'>非常遗憾,您的主机不支持FSO("&FsoString&"),不能使用该功能</Td></Tr>"
Err.Clear
Response.End
End If
If Request("FileName")<>"" Then
If objFSO.Fileexists(Server.Mappath(""&Uploadpath&"/"&Request("FileName"))) Then
objFSO.Deletefile(Server.Mappath(""&Uploadpath&"/"&Request("FileName")))
Else
Response.Write "未找到:<U><Font Color=Red>"&Uploadpath&"/"&Request("FileName")&"</Font></U>"
End If
End If
Set Folder=objFSO.Getfolder(Server.Mappath(Uploadpath))
If Err.Number<>0 Then
Response.Write "<Tr><Td Colspan=6 Class=bk>"&Err.Description&"</Td></Tr>"
Response.End
End If
Set Num=Folder.Files
FileCount=num.count
For Each FileName In folder.files
%>
<tr style="cursor:hand;color:#000000;line-height: 120%;Word-break: keep-all;">
<td align="center" class="bk"><%=procGetFormat(FileName.name)%></td>
<td align="center" class="bk">
<%
if procGetFormat(FileName.name)="jpg" or procGetFormat(FileName.name)="gif" or procGetFormat(FileName.name)="bmp" or procGetFormat(FileName.name)="png" then
%>
<a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank><img src="<%=uploadpath%>/<%=FileName.name%>" width=80 height=80 border="0" onload="javascript:DrawImage(this);"></a>
<% else %>
<a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank>非图片文件不能显示缩览图</a>
<%end if%>
</td>
<td align="center" class="bk">
<%="<a href="&uploadpath&"/"&FileName.name&" target=_blank>"&FileName.name&"</a>"%>
</td>
<td align="center" class="bk"><%=FileName.size%> 字节</td>
<td align="center" class="bk"><%=FileName.datecreated%></td>
<td align="center" class="bk"><a href=?FileName=<%=FileName.name%>&path=<%=request("path")%>>删除</a></td>
</tr>
<%
Next
%>
<tr>
<td colspan="6" align="center" class="bk">
<br>
</td>
</tr>
</table>
<%
Set objFSO=Nothing
Set Folder=Nothing
%>
效果:
- 文件管理
- 文件管理....
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 文件管理
- 镂空针织衫 内搭外穿皆优雅
- 捕捉DB2的锁
- 扁平化CRM:走在时代管理潮流最前端
- Android开发包下载
- 【转帖】讲讲我们的开发和管理理念
- 文件管理
- The journey of a packet through the linux 2.4 network stack
- 第三章字符设备驱动程序
- birt 部署
- xmms已经发布到v1.3了,好久没写博客了
- GCC参数详解
- 看了就会笑的真理
- 添删改时用div + iframe 实现弹出式窗体
- 巧妙使用VIM系列一 2009-12-25 09:26:28