There is no way, practice proved that the best solution is to write an OCX control, so as long as the registration of OCX control can be, at the same time OCX control scalability is very large, that is, to vc\delphi the functions of these programs into the Web, its function can be imagined!
This does not explain the OCX development process, to write their own OCX control share, hoping to give some friends to help.
This OCX control provides a GetFiles () method that simply gets the control object and then calls the GetFiles () method to get all the files under the corresponding path, as shown in the following figure:
The control can select any folder under any letter, the bottom of the image of the button when the Web input, through the Web in the JS method to get a list of files, OCX
The GetFiles () method returns a string of filenames, such as 1.jpg;2.jpg;3.jpg, with ";" in the middle of each filename. Links, use the Split method in JS to separate it.
The page code is as follows:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script type= "Text/javascript" ><!--
Function Show () {
var Obj=document.getelementbyid ("Pathocx");
var str=obj.getfiles ();
var list=str.split (";");
for (Var i=0;i<list.length;i++) {
if (list[i]!= "") {
Alert (List[i]);
}
}
}
--></script>
<body>
<object
Id= "Pathocx"
Classid= "clsid:13bf0862-063c-432f-a8df-07c2823e8562"
width=420
height=300
Align=center
Hspace=0
Vspace=0
>
</OBJECT>
<br>
<input type= "button" Name= "Submit" value= "Display Data" onclick= "Show ()" >
</body>
This allows you to use the control to select any folder, and you can get all the contents of the folder through JS, because space is limited, here is not the OCX more function to do, the next article is ready to add to OCX upload function, so that both upload the entire folder, and support the continuation of the breakpoint.
Last note: OCX used when the need to register the control
Registration method: Run cmd, enter such as OCX control in C:\123.OCX, in cmd run RegSvr32 C:\123.OCX, will be prompted to register successfully, and then can be used in the Web page!
Package Download