开发者

Need to access remote files from Apache server

I am new to Apache.

I am running apache tomcat in windows and using JSP as the server side language.

I have a page containing links to the files (different machine) as below:

<a h开发者_JAVA技巧ref="file:///\\APP-XP3\D\SQLEVAL\books\movies\TheButterflyEffec(2004).avi">TheButterflyEffec(2004).avi</a>
<a href="file:///\\APP-XP1\D\SQLEVAL\books\movies\Superbad.avi">Superbad.avi</a>

Why OnClick, saveAs is not working?

It is working if i save the page locally.

Do I need to configure anything in server.xml?


If the files are loaded on the machine running the apache then you need to look of two thinghs...

  1. Put the files in a directory inside the apache root directory

  2. In the <a href specify the file location with the ip address of it (i.e. if your apache is on a machine with IP 192.XXX.XXX.XX then give the a href as follows

< a href='http://192.XXX.XXX.XX/folderWherefilesare/filename'> filename < / a>


It's not working because the browser look for those files on the local visitor machine, not on the server.

You have to build "proxy" code with server side language like PHP that will get file name as parameter, e.g. Download.php?file=TheButterflyEffec(2004).avi then read the file from the server disk and send the file contents to the browser.

If you're using PHP indeed, here is an article describing what you can do:
http://www.boutell.com/newfaq/creating/forcedownload.html

Otherwise let us know what server side language you can use and retag your question according to this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜