Server to select a file on the server side of the small program, in the server to insert the file, such as server-side has uploaded pictures, or menu management to select the file to be executed, are useful, of course, you can change it to use, it depends on your needs.
Limited to time, can not hit it made like Windows Open File window the same effect, which Netizen did, tell Ah, later I draw the time will do, I hope to progress together with you.
<%@ language=vbscript codepage= "936"%>
<% Option Explicit%>
<%
function GetFileName (strpath)
Dim filename
filename = Mid (Strpath,instrrev (strpath, "\") +1)
GetFileName = filename
End Function
%>
<HTML>
<HEAD>
<title>noteless Valley (lijun.org) Program Example </title>
<meta name= "vs_targetschema" content= "http://schemas.microsoft.com/intellisense/ie5" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= Microsoft Visual Studio.NET 7.0 >
<style type=text/css>
Body
{
font-size:16px;
Border-top-style:none;
Font-family:verdana, song body;
Border-right-style:none;
Border-left-style:none;
Background-color:white;
Border-bottom-style:none;
}
A
{
Text-decoration:none;
}
A:hover
{
Text-decoration:underline;
}
</style>
<script language=javascript>
function selfile (filename) {
Lblmsg.innertext = filename;
}
</script>
</HEAD>
<body>
<%
Dim Strsvrpath, Strcurrentdirectory
Strsvrpath = Request. QueryString ("Path")
If Strsvrpath = "" Then
Strsvrpath = Request. ServerVariables ("Script_name")
Strsvrpath = Mid (Strsvrpath,1,instrrev (Strsvrpath, "/") "Set the initial directory here, where I set the root directory
End If
Strcurrentdirectory = Server. MapPath (Strsvrpath)
Response. Write "Current directory:" & Strsvrpath & "<br>"
Dim fso, folder, subfolder, files, item
Set fso = server. CreateObject ("Scripting.FileSystemObject")
Set folder = FSO. GetFolder (Strcurrentdirectory)
Set subfolder = folder. Subfolders
If Strsvrpath <> "/" Then
Response. Write "<a href=?path=" & Mid (Strsvrpath,1,instrrev (mid Strsvrpath,1,len (Strsvrpath)-1), "/") & ">[to" Parent directory]</a> "&" <br> "
End If
For each item in subfolder
Response. Write "<a href=?path=" & Strsvrpath & GetFileName (item) & "/><font Face=wingdings>0</font > "& _
GetFileName (item) & "</a><br>"
Next
Set files = folder. Files
For each item in files
' Take absolute path
' Response. Write "<a href=javascript:selfile ('" & Strsvrpath & GetFileName (item) & _
' "'); ><font face=wingdings>3</font>" & GetFileName (item) & "</a><br>"
' Fetch filename
' Response. Write "<a href=javascript:selfile ('" & GetFileName (item) & "); ><font Face=wingdings>3</font > "& _
' GetFileName (item) & "</a><br>"
' Take a relative path relative to a directory, this example is '/myweb/'
Response. Write "<a href=javascript:selfile ('" & Replace (Strsvrpath, "/myweb/", "") & GetFileName (item) & "');> <font face=wingdings>3</font> "& _
GetFileName (item) & "</a><br>"
Next
Set fso = Nothing
%>
<p id=lblmsg></p>
</body>
</HTML>