文件URL或如何从URL打开文件夹

时间:2020-12-25 00:29:57

I have several users on an intranet and all have a mapped drive to server (E:). All users are on Win7 and use FireFox. I have used XAMPP on the server to allow users access to MySQL files using PHP. They currently use windows explorer to open a folder on (E:) so save/modify files (jpgs, docs etc.). I want to put a link in the html to open this folder for them.

我在Intranet上有几个用户,并且都有一个到服务器的映射驱动器(E :)。所有用户都在Win7上并使用FireFox。我在服务器上使用了XAMPP,允许用户使用PHP访问MySQL文件。他们目前使用Windows资源管理器打开(E :)上的文件夹,以便保存/修改文件(jpgs,docs等)。我想在html中放一个链接为他们打开这个文件夹。

I've spent some time researching this with varying amounts of success and I have found out that this may have security issues such as...

我花了一些时间研究这一点并取得了不同程度的成功,我发现这可能存在安全问题,例如......

A web application does not have access to the local machine's filesystem

Web应用程序无权访问本地计算机的文件系统

but these are all clients accessing the same server on a local intranet.

但这些都是访问本地Intranet上相同服务器的客户端。

I can type...

我可以打字...

file:///C:/MyFolder/MySubFolder/

in my browser address bar which opens a page with a directory listing of the files in the sub folder. Not ideal but half way to a solution!

在我的浏览器地址栏中打开一个页面,其中包含子文件夹中文件的目录列表。不理想,但解决方案的一半!

But the script below does not work...

但是下面的脚本不起作用......

window.open("file:///C:/MyFolder/MySubFolder/");

Can this be done?

可以这样做吗?

2 个解决方案

#1


you path would be

你的道路会是

window.open("http://localhost/MyFolder/MySubFolder/");

or

window.open("http://IP/MyFolder/MySubFolder/");

use absolute path for this

使用绝对路径

#2


Firefox will work if the link is in its own mangled form using five slashes (file://///C:/MyFolder/MySubFolder/) and the user has disabled the security restriction on file: links in a page served over HTTP.

如果链接使用五个斜杠(文件:///// C:/ MyFolder / MySubFolder /)并且用户已禁用文件的安全限制:在通过HTTP提供的页面中的链接,Firefox将工作。

check this post for more info

查看这篇文章了解更多信息

#1


you path would be

你的道路会是

window.open("http://localhost/MyFolder/MySubFolder/");

or

window.open("http://IP/MyFolder/MySubFolder/");

use absolute path for this

使用绝对路径

#2


Firefox will work if the link is in its own mangled form using five slashes (file://///C:/MyFolder/MySubFolder/) and the user has disabled the security restriction on file: links in a page served over HTTP.

如果链接使用五个斜杠(文件:///// C:/ MyFolder / MySubFolder /)并且用户已禁用文件的安全限制:在通过HTTP提供的页面中的链接,Firefox将工作。

check this post for more info

查看这篇文章了解更多信息