The web today looked at Ccopus's DM45 and did a great job, and I wanted to do it before, doing a program that was very similar to Windows Explorer. When I saw Dm45, I thought I'd give up. Web way of file management is in the permission to operate in any case, and everyone to achieve the same, nothing more than in the appearance, easy to operate on the issue, file management is not very large, if the permissions of multiple users is more difficult to control, since others have done, I think it is better not to repeat the work, and it is not necessarily good to do it. The following code is posted to commemorate the local ordering of the file. But the hierarchy between the directories has not been well done. Interested can take to refer to, theoretically should be able to achieve with Windows Explorer very similar interface and operation mode. The entire interface takes no refresh mode. Use XMLHTTP to execute the background code, with JS to modify the foreground display. Here embodies a thought, hope for beginners can have a help.
The code is as follows:
<title>web File Manager version 2.0 http://asp2004.net</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
<!--
A
font-size:9pt;
Color: #3300CC;
Text-decoration:none;
}
Body {
font-size:9pt;
margin-left:0px;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
line-height:20px;
Background-color: #EEEEEE;
}
TD {
font-size:9pt;
line-height:20px;
}
. TX {
Border-color: #000000;
border-left-width:0px;
border-top-width:0px;
border-right-width:0px;
border-bottom-width:1px;
font-size:9pt;
Background-color: #EEEEEE;
}
. tx1 {
font-size:9pt;
BORDER:1PX solid;
Border-color: #000000;
Color: #000000;
}
-->
</style>
<%
' Copyright notice: This code is only for study and research purposes, and I am not responsible for any consequences arising from the use of this procedure. shall not be used for commercial purposes without the written permission of the author.
' qq:103895
' Email:quxiaohui_0@163.com
' Http://asp2004.net
Server.ScriptTimeout = 999
Action = Request ("action")
temp = Split (Request.ServerVariables ("URL"), "/"
url = temp (UBound (temp))
Const pass = "' Login password"
' Login Verification
Set fso = CreateObject ("Scripting.FileSystemObject")
Path = Request ("foldername")
If path = "" Then Path = server. MapPath ("./")
Showfolderlist (Path)
Set FSO = Nothing
' List files and folders
Function showfolderlist (FOLDERSPEC)
temp = Request.ServerVariables ("Http_referer")
temp = Left (temp, InStrRev (temp, "/"))
Temp1 = Len (folderspec)-Len (server. MapPath ("./"))-1
If temp1>0 Then
Temp1 = Right (Folderspec, CInt (TEMP1)) + "\"
ElseIf Temp1 =-1 Then
Temp1 = ""
End If
Tempurl = temp + Replace (temp1, "\", "/")
Uppath = "./" + Replace (Temp1, "\", "/")
Upfolderspec = fso. Getparentfoldername (folderspec& "\")
Set f = fso. GetFolder (FOLDERSPEC)
%>
<script language= "JavaScript" >
function File (Name, Size, Type, DateCreated, datelastaccessed, datelastmodified, Attributes)
{
This. name = name;
This. size = size;
This. type = type;
This. DateCreated = DateCreated;
This. datelastaccessed = datelastaccessed;
This. DateLastModified = datelastmodified;
This. Attributes = Attributes;
}
function tree (ID, name)
{
This.id = ID;
THIS.name = name;
This.root = new Array ();
this.length = 0;
This. ADD = function (file)
{
This.root.push (file);
This.length + 1;
}
This.max = function (f1, F2, field)
{
Switch (field)
{
Case "Name":
Return F1. Name.tolowercase () >f2. Name.tolowercase ()? True:false;
Case "Size":
Return F1. Size>f2. Size? True:false;
Case "Type":
if (field = = '??? T? D ') return false;
Return F1. Type>f2. Type? True:false;
Case "DateCreated":
Return F1. Datecreated>f2. DateCreated? True:false;
Case "datelastaccessed":
Return F1. Datelastaccessed>f2. Datelastaccessed? True:false;
Case "DateLastModified":
Return F1. Datelastmodified>f2. DateLastModified? True:false;
Case "Attributes":
Return F1. Attributes>f2. Attributes? True:false;
Default
return false;
}
}
This.sort=function (field, order)
{
ORDER:DESC ASC
Field:name Size
var len = this.root.length;
if (Len < 2) return;
var tmp;
for (var i=0; i<len-1; i++)
{
for (var j=i+1; j<len; J + +)
{
if (order = = "desc")
{
if (!this.max (This.root[i], this.root[j], field)
{
TMP = This.root[i];
This.root[i] = This.root[j];
This