dongnianwo8289 2015-05-12 18:26
浏览 29

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

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. The solution can't be found
  3. Anybody who may be able to help has not yet seen it.

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

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

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

  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

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

My question is what should my anchor look like to get to 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条回答 默认 最新

  • dqnhfbc3738 2015-05-12 18:42
    关注

    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.

    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:

    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.

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据