链接到更高级别文件夹中的文件 [英] Link to a file in a higher level folder

查看:73
本文介绍了链接到更高级别文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < a href = '.. / .. /家/文件夹/ document.docx' >投标< / A> 

在浏览器中,上述内容被解释为:

  http://localhost/home/folder/document.docx 

我看不到浏览器正在文件夹中,然后得到的答案是:

 未找到
在此服务器上未找到请求的URL /home/folder/document.docx。

我曾在Firefox和Chrome上尝试过,它发生的情况也是如此。我在Linux机器上使用了Apache Web服务器。



任何帮助都将被理解。

解决方案

您无法将访问者重定向到文档根目录之外的文件(您拥有index.html的位置)。
人们看不到比 http:// localhost / 结尾处更高的文件。



解决方法是将 .docx 放入文档根目录(您的index.html所在的位置)。



然而,您可以让PHP使用阅读文件功能来提供文件。
但请不要忘记,www数据需要有权访问您正在提供的文件。


I'm having troubles serving a document which is in a higher level than my root folder.

<a href='../../home/folder/document.docx'>Proposal</a>

In the browser the above gets interpreted as:

http://localhost/home/folder/document.docx

I cannot see the browser going up in the folders and then the answer I get is:

Not Found
The requested URL /home/folder/document.docx was not found on this server.

I have tried in Firefox and Chrome, it happens the same. I am using Apache Web Server on a Linux machine.

Any help will be appreciated.

解决方案

You can not redirect your visitors to a file outside of your document root (where you have your index.html). People can't see files higher than where http://localhost/ ends up in.

A solution would be to put that .docx inside of your document root (where your index.html is in).

You can however let PHP serve the file using the readfile function. But don't forget that www-data would need to have access to the file you're serving.

这篇关于链接到更高级别文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆