t4dohx
t4dohx

Reputation: 668

Unable to access file in hard drive using Apache Tomcat server

I'm developing local-only JSP application using Apache Tomcat server. I would like to put a promotion videos on my intro page, but I don't want to move them to webapp folder or anywhere else.

The promotion videos are located:

But writing a JSP/HTML like this wont launch the video, but however it works off-server (launching html from desktop for example, so the path may not be issue?)

<video src="file:///E:/data/videos/2018/promotion1.mp4" controls></video>

Upvotes: 0

Views: 1597

Answers (2)

Alexey
Alexey

Reputation: 1539

Local file links from remote resources are disabled by almost all browsers by default. There are certain possibilities to overcome that, e.g.:

http://kb.mozillazine.org/Links_to_local_pages_do_not_work

https://discourse.mozilla.org/t/opening-links-to-local-files-file/16449/2

To access your static media files from remote page you need to configure your Tomcat server as described here: http://teknosrc.com/access-local-files-static-content-images-videos-media-files-outside-web-application-system-apache-tomcat-server/

Upvotes: 1

Yash Sharma
Yash Sharma

Reputation: 11

solution: a.) make sure your server is on the same system where the media files are.

b.) If so, you have to create a folder (ex. media) in your application folder inside /src/main/webapp/ and have to put all media files inside a media folder. After that, you can surely access the media files through a server.

Upvotes: 1

Related Questions