Use XML + FSO + JS to implement server-side files. First, create a program on the server to generate an XML file to return to the client, (getfolder. asp) quot; folder) iffoldersthenfoldersendifdimcountcount0fo create a program on the server to generate an XML file to return to the client (getfolder. asp) <% written by Linzhang Chen, 2003-4-20 reprinted, please indicate the source and retain this copyright information response. write" "& Chr (13) response. write" "& Chr (13) folders = request (" folder ") if folders ="/"then folders =" "end if dim count = 0 folders = replace (folders, ".. "," ") basefolder = ".. /media/"The baseline 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 response folder list under the specified path. write" "& Chr (13) response. write" Folder "& Chr (13) response. write" "& Fd. name &" "& Chr (13) response. write" "& Chr (13) count = count + 1 next set sf = nothing set ff = f. files for each fi in ff fname = fi. name if instr ("asf, wma, wmv", lcase (mid (fname, limit Rev (fname ,". ") + 1)> 0 then: specifies the file type that can be returned to prevent the source code from leaking response. write" "& Chr (13) response. write" File "& Chr (13) response. write" "& Fname &" "& Chr (13) response. write" "& Chr (13) 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 (13) response. write" Empty "& Chr (13) response. write" 0 "& Chr (13) response. write" "& Chr (13) end if response. write" "Set ff = nothing set f = nothing set fso = nothing %> below is the JS effort of the client (selectfile. asp) Select a video file Search range (
I): File type (
T): Streaming media files (*. asf, *. wmv, *. wma) There is also a small file named "blank.htm" to define the display style of files and folders. New Document When calling the following function, you can implement the function selectfile () {var arr = showModalDialog ("selectfile. asp? Temp = "+ Math. random ()," "," dialogWidth: Pixel px; dialogHeight: 252px; status: 0; help: 1 "); if (arr! = Null) {return arr} the function returns the selected file name, several images used in the function are automatically captured from the file selection box. :) It is estimated that you may encounter various unknown bugs during use. please contact me: E_mail: clzwin@sina.com
Exist, (getfolder. asp) quot; folder) if folders =/then folders = end if dim count = 0 fo...