ASP + FSO online image management functions original

Source: Internet
Author: User

CopyCode The Code is as follows: <%
'---------------------------------------------
############## 20060528 port Support added
'Author: dxy QQ: 461478385 Email: douxy001@gmail.com
'Complete functions
%>
<! -- # Include file = "Global. asp" -->
<! -- # Include file = "session. asp" -->
<%
Set myfile = server. Createobject ("scripting. FileSystemObject ")
If request. Form ("action") = "delall" then
Num = request. Form ("delfilename"). Count
For x = 1 to num
Thedelall = server. mappath ("../upload/" & request. Form ("delfilename") (x ))
If myfile. fileexists (thedelall) then
Myfile. deletefile (thedelall)
End if
Next
End if
Page = CINT (request. querystring ("page "))
If page <= 1 or page = "" Then page = 1
Pagesize = 25
Domain = request. servervariables ("SERVER_NAME ")
Gfilepath = request. servervariables ("path_info ")
SERVERPORT = request. servervariables ("server_port ")
Gfilepath = lcase (left (gfilepath, limit Rev (gfilepath ,"/")))
Countn = Len (gfilepath)
Gfilepath = lcase (left (gfilepath, CountN-1 ))
Gfilepath = lcase (left (gfilepath, limit Rev (gfilepath ,"/")))
If SERVERPORT <> "80" then
Allpath = "http: //" & domain & ":" & SERVERPORT & gfilepath
Else
Allpath = "http: //" & domain & gfilepath
End if
Filepath = "../upload /"
Dim FSO
Set FSO = server. Createobject ("scripting. FileSystemObject ")
Set thefolder = FSO. getfolder (server. mappath (filepath ))
For each ffiles in thefolder. Files
Filecounts = filecounts + 1
Filesizes = filesizes + ffiles. Size
If filesizes = 0 then
Response. Write "NO content in this folder"
Response. End
End if
Next

%>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> dxy File Manager </title>
<Link href = "main.css" rel = "stylesheet" type = "text/CSS"/>
<Script language = "JavaScript" type = "text/JavaScript">
Function checkall ()
{
For (VAR Ic = 0; IC <form1.delfilename. length; IC ++)
{
VaR E = form1.delfilename [IC];
E. Checked =! E. checked;
}
}
</SCRIPT>
</Head>

<Body style = "margin: 0px;">
<Table width = "760" border = "0" align = "center" cellpadding = "3" cellspacing = "1" bgcolor = "# 1f429e">
<Form action = "" method = "Post" name = "form1"> <tr>
<TD width = "40" Height = "25" bgcolor = "# ffffff"> <Div align = "center"> NO. </div> </TD>
<TD width = "493" Height = "25" bgcolor = "# ffffff"> <Div align = "center"> file name </div> </TD>
<TD width = "100" bgcolor = "# ffffff"> <Div align = "center"> file size </div> </TD>
<TD width = "98" bgcolor = "# ffffff"> <Div align = "center"> select </div> </TD>
</Tr>
<%
I = 0
For each ffiles in thefolder. Files
I = I + 1
If ccount> = pagesize then
Exit
Elseif I> pagesize * (page-1) then
Ccount = ccount + 1
%>
<Tr>
<TD Height = "25" nowrap = "nowrap" bgcolor = "# ffffff" align = "center"> <% = I %> </TD>
<TD nowrap = "nowrap" bgcolor = "# ffffff"> <a href = "<% = allpath &" upload/"& ffiles. name %> "target =" _ blank "> border = "0"/> </a> </TD>
<TD nowrap = "nowrap" bgcolor = "# ffffff"> <Div align = "center"> <% = ffiles. size %> [byte] </div> </TD>
<TD nowrap = "nowrap" bgcolor = "# ffffff">
<Div align = "center">
<Input name = "delfilename" type = "checkbox" id = "delfilename" value = "<% = ffiles. name %>"/>
</Div> </TD> </tr>
<%
End if
Next
%>
<Tr>
<TD Height = "30" colspan = "4" bgcolor = "# ffffff"> <Div align = "center">
Total files <font color = "# ff0000" style = "font-family: Georgia, 'times new Roman ', times, serif "> <% = filecounts %> </font>, occupied space <font color =" # ff0000 "style =" font-family: Georgia, 'times new Roman ', times, Serif "> <% = formatnumber (filesizes/1024), 2) %> K </font> <br/>
<Input name = "dxy_foldername" type = "hidden" id = "dxy_foldername" value = "<% = request (" dxy_foldername ") %>"/>
<Input type = "button" name = "submit2" value = "select all/invert" onclick = "checkall ()"/>

<Input type = "Submit" name = "Submit" value = "delete selected file"/>
</P>
<Input name = "action" type = "hidden" id = "action" value = "delall"/>
</Div> </TD>
</Tr>
</Form>
</Table>
<Table width = "760" Height = "21" border = "0" align = "center" cellpadding = "0" cellspacing = "0">
<Tr>
<TD bgcolor = "# ffffff"> <Div align = "center">
<%
If filecounts mod pagesize = 0 then
Pagecount = filecounts/pagesize
Else
Pagecount = filecounts/pagesize + 1
End if
If page> pagecount then
Page = pagecount
Else
Page = page
End if
For II = 1 to pagecount
If page = II then
Response. Write "<a href = picmanage. asp? Page = "& II &"> [<font color = Red> "& II &" </font>] </a>"
Else
Response. Write "<a href = picmanage. asp? Page = "& II &"> ["& II &"] </a>"
End if
Next
%>
</Div> </TD>
</Tr>
</Table>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.