Home > Backend Development > PHP Tutorial > Implementing server-side files using XML+FSO+JS_PHP tutorial

Implementing server-side files using XML+FSO+JS_PHP tutorial

WBOY
Release: 2016-07-13 17:24:26
Original
712 people have browsed it

First, create a program on the server side to generate an XML file to return to the client, (getfolder.asp) "&chr(13) response.write ""&chr(13) 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 a list of folders under the specified path response.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,instrrev (fname,".")+1)))>0 then set the file types allowed to be returned to prevent source code leakage 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, then 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 %> The following is the work of the client's JS (selectfile. asp) quot;-//W3C//DTD HTML 4.0 Transitional//EN">

Select video file Search range (I): Implementing server-side files using XML+FSO+JS_PHP tutorial Implementing server-side files using XML+FSO+JS_PHP tutorial File type (T): There is also a small file blank.htm inside to define the style of displaying files and folders quot;-//W3C//DTD HTML 4.0 Transitional//EN"> New Document When calling, use the following function to achieve the effect of selecting files on the server side that looks just like the real thing: function selectfile() { var arr = showModalDialog("selectfile.asp?temp="+Math.random(), "", " dialogWidth:453px; dialogHeight:252px; status:0;help:1"); if (arr != null) { return arr } } The last thing returned by this function is the selected file name. Here are some pictures used in the function. I caught it myself from the file selection box:) It is estimated that you may encounter various unknown BUGs during use. Welcome everyone to communicate with me: E_mail: clzwin@sina.com

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532141.htmlTechArticleFirst 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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template