Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7940273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:20:20+00:00 2026-06-03T23:20:20+00:00

i want to download a file by its path(local server path) which is stored

  • 0

i want to download a file by its path(local server path) which is stored in a database table ,i have done the coding part to view the database in a html table but i dont have any idea how to hyperlink the table in order to download the file(any type and size) from the ouput folder that is stored in a server.
here is the jsp code :

<%@ page import="java.io.*,java.sql.*"%>

<%
String id=request.getParameter("id");
Class.forName("com.mysql.jdbc.Driver").newInstance();  
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306  /ksa","root","root");  
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select id,file_path,file_date from file12 where id like '"+id+"%'"); 
%>
<table cellpadding="15" border="1">
<%
while(rs.next()){
%>
<tr>
<td><%=rs.getString("id")%> </td>
<td><%=rs.getString("file_path")%> </td>
<td><%=rs.getString("file_date")%> </td>
</tr>
<%}%>
</table>

the above code will retrieve the table from database to html table.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:20:21+00:00Added an answer on June 3, 2026 at 11:20 pm

    If the rs.getString(“file_path”) returns a path is /home/Desktop/output/something.jpeg means you cannot download.Because when you click the given link surely it will show PAGE NOT FOUND (404) Exception.

    “> click here to download the file

    please note your URL it will look like

    http://localhost:8080/prjname/home/Desktop/output/something.jpeg

    So in this situation we can pass the path into one servlet ,through this servlet we can download the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to download a PDF file from a SQL Server database which is
I have a large file I want to download from a server I have
I have an array of file names which I want to download. The array
i have button, on a click of which i want to download the file
I have a table which repeats an image link to a file download for
I want to download a .zip file which is available at URL http://www.nseindia.com/content/equities/cmbhav.htm by
I want to download a file on a website using C# and show its
I want to download a file and need to check the response status code
I got a WPF application and I want to download a file. I'm using
I want to download a wav file from a web service, cache it on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.