First create a program on the server side to generate an XML file to return to the client, (getfolder.asp) <% written by Linzhang Chen, 2003-4-20 reprint please specify the source and retain this copyright information Response.Write " "&CHR (Response.Write)" "&CHR" Folders=request ("folder") if folders= "/" Then folders= "" End If Dim count count=0 folders=replace (folders, " .. "," ") basefolder=". /media/"Base folder path Newfolder=basefolder&folders Set FSO =server. CreateObject ("Scripting.FileSystemObject") Set F=fso.getfolder (Server.MapPath (NewFolder)) set sf=f.subfolders for Each FD in SF returns the folder list below the specified path Response.Write " "&CHR (Response.Write)" folder "&CHR (Response.Write" "&fd.name&" "&CHR (Response.Write)" "&CHR" count=count+1 next set sf=nothing set ff=f.files for each fi in FF Fname=fi.name if InStr ("Asf,wma,wmv", Lcas E (Mid (Fname,instrrev (fname, ".") +1))) >0 then set the allowed file types to be returned, preventing the source from leaking Response.Write " "&CHR (Response.Write)" file "&chr Response.Write" " &fname& " &A MP;CHR (Response.Write) " &CHR Count=count+1 End If Next if there is no file in the directory, send an empty element if Count=0 then Response.Write " "&CHR" Response.Write " Empty " &CHR (Response.Write " 0 " &CHR) resp Onse.write " "&CHR () End If Response.Write" The set ff=nothing set f=nothing set fso=nothing%> below is the client's JS effort (selectfile.asp) <title>Select a video file</title> Lookup Range (
I): File Type (
T): Streaming media files (*.asf,*.wmv,*.wma) There's a small file in it. Blank.htm used to define the style of file and folder display <title>New Document</title> Call the time with the following function, you can realize the effect of the server-side selection of the file's effects function selectfile () {var arr = ShowModalDialog ("selectfile.asp?temp=" +math.random (), "", "DIALOGWIDTH:453PX; dialogheight:252px; Status:0;help:1 "); if (arr! = null) {return arr}} This function finally returns the selected file name, the function inside the use of a few pictures of the user has been grabbed from the file selection box:) estimated in the use of the process may also encounter a variety of unknown bugs welcome everyone and I exchange: E_Mail: Clzwin@sina.com
http://www.bkjia.com/PHPjc/532141.html www.bkjia.com true http://www.bkjia.com/PHPjc/532141.html techarticle first create a program on the server side to generate an XML file to return to the client, (getfolder.asp) quot; quot;folder) if folders=/then folders= End If Dim count count=0 Fo ...