简体   繁体   English

您可以使用JavaScript但不使用ActiveX在目录中列出文件吗?

[英]Can you list files in a directory with JavaScript but without ActiveX?

I wrote a script in php that allows me to get a list of files in a directory as an array, parse each one for a particular string, and then it displays all of the files that contain the search string. 我用php编写了一个脚本,该脚本允许我以数组的形式获取目录中的文件列表,为每个字符串解析一个特定的字符串,然后显示包含搜索字符串的所有文件。

My IT staff won't let me install php on the server though. 我的IT人员不会让我在服务器上安装php。 Can this be done with javascript without ActiveX? 可以在没有ActiveX的情况下使用javascript完成此操作吗? Everything I could find on this is pretty old. 我所能找到的一切都已经很老了。

Alternatively, is there a way to make php functions like opendir and readir work on a remote server? 另外,有没有办法使像opendir和readir这样的php函数在远程服务器上工作?

Thanks 谢谢

Nor JavaScript / ActiveX will help you do what you need to do if the directories are on a remote server. 如果目录位于远程服务器上,JavaScript / ActiveX也不会帮助您执行所需的操作。 So no, can't be done. 所以不,无法完成。

This would be quite the security violation if you could. 如果可以的话,这将完全违反安全性。 You will need to have something installed on the server that has file system access. 您将需要在具有文件系统访问权限的服务器上安装某些内容 If this is on an internal network, you may be able to simply enable directory browsing... but there aren't any client-side-only solutions to this. 如果这是在内部网络上,则可以只启用目录浏览...,但是没有任何客户端专用的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM