When selecting folders in web application development, this is troublesome for web programmers. Because of local security restrictions, JS cannot access local files, folder selection is generally avoided, when I was writing a program, I also encountered the same problem. I started to try to use JS to traverse files, and there was no way to get the result, practice has proved that the best solution is to write an OCX control by yourself, so you only need to register the OCX control, and the OCX control is highly scalable, that is to say, to introduce the functions of vc \ delphi to the web, its functions can be imagined!
I will not describe the OCX development process here. I will share the OCX control I wrote with you and hope to help some friends.
The OCX control provides a getFiles () method. You only need to obtain the control object and call the getFiles () method to obtain all the files in the corresponding path, for example:
This control can select any folder under any drive letter. In the figure, the following buttons are used to obtain the file list through the web js method, OCX
The getfiles(), for example, 1.jpg;2.jpg;3.jpg. Use the ";" link in the middle of each file name, and use the split method in js to separate the file.
The page code is as follows:
The Code is as follows:
Untitled document