简体   繁体   中英

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:

<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. 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

If you're targetting /tmp/hello.xls on the client machine

To target a local file, you'll need to specify 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?

If you're targetting /tmp/hello.xls on the web server

You cannot directly access a file on the server that's not in the web root.

If you give more details about what you're trying to achieve, we might be able to give more specific advice.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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