如何在C:上从Intranet打开文件夹

时间:2021-07-26 00:32:00

I've been tackling this for 2 days now without success. Yesterday I posted a question here to which I received a couple of suggestions which I didn't really understand.

我现在已经解决了这两天没有成功。昨天我在这里发了一个问题,我收到了一些我并不理解的建议。

I asked for clarification and have had no response yet.

我要求澄清,但尚未得到答复。

Either:

  1. I'm not explaining myself very well.
  2. 我不是很好地解释自己。

  3. The solution can't be found
  4. 找不到解决方案

  5. Anybody who may be able to help has not yet seen it.
  6. 任何可能提供帮助的人还没有看到它。

OK - here goes - nice 'n' simple....

好的 - 在这里 - 很好'n'简单....

I'm using a XAMPP server on WIN7 with FireFox.

我在WIN7上使用FireFox的XAMPP服务器。

  1. At my browser address bar I can type : file:///C:/xampp/htdocs/folder1/subfolder1/, which is sort of OK

    在我的浏览器地址栏中,我可以输入:file:/// C:/ xampp / htdocs / folder1 / subfolder1 /,这有点好

  2. I put the following code inside an anchor in a page and run it from XAMPP/htdocs folder : href="folder1/subfolder1/">Go to subfolder1, yields similar sort of result

    我将以下代码放在页面中的一个锚点中并从XAMPP / htdocs文件夹运行它:href =“folder1 / subfolder1 /”>转到子文件夹1,产生类似的结果

  3. At my browser again I type : file:///C:/folder2/subfolder2/ and have the same sort of result as 1.

    再次在我的浏览器中输入:file:/// C:/ folder2 / subfolder2 /,结果与1相同。

My question is what should my anchor look like to get to C:/folder2/subfolder2/

我的问题是我的锚看起来应该是什么样的C:/ folder2 / subfolder2 /

Is there something I am not understanding?

有什么我不理解的吗?

If someone out there can post a 'fiddle' or show me an example I'm sure I could work through this

如果那里有人可以张贴'小提琴'或给我一个例子,我相信我可以解决这个问题

2 个解决方案

#1


This doesn't work by default because allowing someone to access the local file system that the server is running on from outside the computer would be a security breach. You can type it in the URL field because your browser is running on the same machine and has access to the drive.

默认情况下这不起作用,因为允许某人从计算机外部访问运行服务器的本地文件系统将是一个安全漏洞。您可以在URL字段中键入它,因为您的浏览器在同一台计算机上运行并且可以访问该驱动器。

If you want to open it from a link inside of an HTML file from a client, you'll need to write a program that runs on the server (PHP is a good language to use) that would receive the request and display the folder contents. Of course this wouldn't a very safe thing to do, but the URL might look like this:

如果要从客户端的HTML文件内部链接打开它,则需要编写一个在服务器上运行的程序(PHP是一种很好用的语言),它将接收请求并显示文件夹内容。当然,这不是一件非常安全的事情,但URL可能如下所示:

http://yourserver/showfolder.php?dir=c:/folder1/subfolder2

Then you just need to write showfolder.php and have it use the parameter dir and respond with html to display the folder contents. Again, though it's possible to do this, you should think hard about why you want to and what information you're making available outside of the machine that others should not see.

然后你只需要编写showfolder.php并让它使用参数dir并用html响应来显示文件夹内容。同样,尽管可以这样做,但您应该仔细考虑您想要的原因以及您在机器外部提供的其他人不应该看到的信息。

I think the thing you're not understanding is what program is interpretting the url in each case. Whey you type file://... into the browser, it's the browser doing the work of finding the content on disk and showing it to you. When you use a url, that's an http request which asks your server to do the work.

我认为你不理解的是在每种情况下程序正在解释url。当你在浏览器中输入file:// ...时,浏览器会在磁盘上查找内容并向你显示内容。当您使用网址时,这是一个http请求,要求您的服务器完成工作。

#2


Your question is meant mainly by Apache Creating alias and directory listings. In your Apache conf at C:\xampp\apache\conf\httpd.conf add new alias like the following:

您的问题主要是由Apache Creating别名和目录列表。在您的Apache conf:C:\ xampp \ apache \ conf \ httpd.conf中添加如下所示的新别名:

Alias /subfolder2 C:/folder2/subfolder2
<Directory "C:/folder2/subfolder2">
  Options FollowSymLinks +Indexes
  Order Allow,Deny
  Allow from All
  AllowOverride All Indexes Options
</Directory>

By this way you can get listing the contents of C:/folder2/subfolder2/ just as simple as

通过这种方式,你可以列出C:/ folder2 / subfolder2 /的内容就像这样简单

<a href=http://localhost/subfolder2">Subfolder2 Contents</a>

#1


This doesn't work by default because allowing someone to access the local file system that the server is running on from outside the computer would be a security breach. You can type it in the URL field because your browser is running on the same machine and has access to the drive.

默认情况下这不起作用,因为允许某人从计算机外部访问运行服务器的本地文件系统将是一个安全漏洞。您可以在URL字段中键入它,因为您的浏览器在同一台计算机上运行并且可以访问该驱动器。

If you want to open it from a link inside of an HTML file from a client, you'll need to write a program that runs on the server (PHP is a good language to use) that would receive the request and display the folder contents. Of course this wouldn't a very safe thing to do, but the URL might look like this:

如果要从客户端的HTML文件内部链接打开它,则需要编写一个在服务器上运行的程序(PHP是一种很好用的语言),它将接收请求并显示文件夹内容。当然,这不是一件非常安全的事情,但URL可能如下所示:

http://yourserver/showfolder.php?dir=c:/folder1/subfolder2

Then you just need to write showfolder.php and have it use the parameter dir and respond with html to display the folder contents. Again, though it's possible to do this, you should think hard about why you want to and what information you're making available outside of the machine that others should not see.

然后你只需要编写showfolder.php并让它使用参数dir并用html响应来显示文件夹内容。同样,尽管可以这样做,但您应该仔细考虑您想要的原因以及您在机器外部提供的其他人不应该看到的信息。

I think the thing you're not understanding is what program is interpretting the url in each case. Whey you type file://... into the browser, it's the browser doing the work of finding the content on disk and showing it to you. When you use a url, that's an http request which asks your server to do the work.

我认为你不理解的是在每种情况下程序正在解释url。当你在浏览器中输入file:// ...时,浏览器会在磁盘上查找内容并向你显示内容。当您使用网址时,这是一个http请求,要求您的服务器完成工作。

#2


Your question is meant mainly by Apache Creating alias and directory listings. In your Apache conf at C:\xampp\apache\conf\httpd.conf add new alias like the following:

您的问题主要是由Apache Creating别名和目录列表。在您的Apache conf:C:\ xampp \ apache \ conf \ httpd.conf中添加如下所示的新别名:

Alias /subfolder2 C:/folder2/subfolder2
<Directory "C:/folder2/subfolder2">
  Options FollowSymLinks +Indexes
  Order Allow,Deny
  Allow from All
  AllowOverride All Indexes Options
</Directory>

By this way you can get listing the contents of C:/folder2/subfolder2/ just as simple as

通过这种方式,你可以列出C:/ folder2 / subfolder2 /的内容就像这样简单

<a href=http://localhost/subfolder2">Subfolder2 Contents</a>