列出 Web 应用程序上的本地目录
我有一个 Web 应用程序的想法,我需要列出客户端计算机上存在的目录的所有文件(例如 C:\Temp)。
我在互联网和 Stack Overflow 上搜索了很多。我找不到解决我问题的任何问题的答案。
我希望能够列出目录的所有文件和子目录,并如果可能的话获取文件类型。
我知道这不能只用原生 Javascript 来完成。如果有一些东西限制像 Firefox、XPCOM 这样的浏览器,我不介意使用。
我只是想知道在 WEB 应用程序上执行此操作的最佳方法是什么。 (Windows 应用程序是不可接受的,并且也不想依赖 ActiveX,因为我们不打算支持 IE)。
我们偏爱基于 Javascript 的解决方案。我们真的不想依赖服务器端来做到这一点。但我们愿意接受服务器端的建议。 对于任何服务器端建议,我们都使用 ASP .NET MVC。
我们正在寻找类似于 jscript - 获取目录中的文件列表 但我根本不想依赖 ActiveX。正如之前所说,仅适用于 Firefox 的解决方案就可以了。
I have an idea a Web Application and I would need to list all files of a directory that exists on the client machine (For example C:\Temp).
I searched a lot on the Internet and as well on Stack Overflow. I couldn't find an answer on any questions that soved my problems.
I want to be able to list all files and subdirectories of a directory and if possible get the file type.
I know that this isn't able to do only with native Javascript. If there is something restricted to a browser like Firefox, like XPCOM I wouldn't mind using.
I just wanted to know what is the best approach to do this on a WEB Application. (Windows apps are not acceptable, and also don't want to rely on ActiveX since we're no planning on IE support).
We have a preference for Javascript based solutions. We really don't want to rely on Server-Side to do this. But we are opened to Server-Side suggestions.
For any server-side suggestion, we are using ASP .NET MVC.
We area looking for something similar to jscript - getting list of files in directory but I don't want to rely on ActiveX at all. As said before a Firefox-only solution would be OK.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之:您无法从浏览器获取列出本地系统(客户端计算机)上的文件的控件。
In short:You can't get the control to list the files resides on local system(client machine) from browser.
如果用户在弹出的对话框中单击“允许”,则 Java 小程序(如果已签名并正确设置)就可以访问本地文件系统。
Flash 和 Silverlight 是由智能生物构建的,不允许您访问本地文件系统 - 如果允许,它们也会弹出一个对话框,询问用户是否信任该 Web 应用程序。否则,人们可能会使用它来收集有关您的系统的各种潜在危险信息。
Java applets, if signed and set up properly, can get access to the local filesystem if the user clicks allow on the popup dialog box.
Flash and Silverlight, being built by intelligent beings, do not allow you access to the local filesystem -- and if they did, they would also have a dialog pop up asking if the user trusts the web app. Otherwise people could use it to collect all sorts of potentially dangerous information about your system.