简体   繁体   English

如何打开在Linux服务器下找到的.xls文件?

[英]how can I open .xls file found under a linux server?

I am trying to open a .xls file found under a linux server using a web page, using: 我正在尝试使用以下网页打开在Linux服务器下找到的.xls文件:

<a href="/tmp/hello.xls">click here</a>

I got a result "resource not found" ; 我得到的结果是“找不到资源” however I am sure than it is found under the /tmp directory. 但是,我敢肯定会在/tmp目录下找到它。 Any suggestions please? 有什么建议吗?

That's because when you use href="/tmp/hello.xls" , the browser will interpret that as an absolute path relative to the current domain, ie http://your_website_domain/tmp/hello.xls , which may not be what you want 那是因为当您使用href="/tmp/hello.xls" ,浏览器会将其解释为相对于当前域的绝对路径,即http://your_website_domain/tmp/hello.xls ,这可能不是您所使用的想

If you're targetting /tmp/hello.xls on the client machine 如果您要在客户端计算机上/tmp/hello.xls

To target a local file, you'll need to specify href="file:///tmp/hello.xls" . 要定位本地文件,您需要指定href="file:///tmp/hello.xls" Unfortunately, that may not work on some browsers which security settings in place which stops the loading of local files from external content. 不幸的是,这可能不适用于某些浏览器,这些浏览器的安全设置到位,从而阻止了从外部内容中加载本地文件。

For more details and a possible workaround, check out this question: How do I make a file:// hyperlink that works in both IE and Firefox? 有关更多详细信息和可能的解决方法,请查看以下问题: 如何制作在IE和Firefox中均可使用的file://超链接?

If you're targetting /tmp/hello.xls on the web server 如果您要在Web服务器上/tmp/hello.xls

You cannot directly access a file on the server that's not in the web root. 您不能直接访问不在Web根目录中的服务器上的文件。

If you give more details about what you're trying to achieve, we might be able to give more specific advice. 如果您提供有关要实现的目标的更多详细信息,我们可能会提供更具体的建议。

通过href链接确保xls文件的路径正确。

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

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