Download a file from a server using the HTML page (Java, HTML)

advertisements

I would like to download a file throw the link from my html-page.

I have this file in a folder on the server. I have shared this folder for all. The path to my file, for example is:

//bogn/folder/spi.jar

If I enter the path

file://bogn/folder/spi.jar

directly to the browser URL - then downloading is going successfully.

As I need to download the file from the HTML-page I use link:

<a href="file://bogn/folder/spi.jar" download> Download JAR </a>

The browser asks the question whether to save the file and then ignore saving. I can see the error: Network error.

How I can fix this? Thank you.


The path to the file needs to be publicly accessible. If, for example, your html file in in the root web directory, and your jar file is inside "folder" in the same directory, then this will work:

<a href="folder/spi.jar" download> Download JAR </a>