Closed Thread Icon

Topic awaiting preservation: How do I download a file from Oracle with a click. Pages that link to <a href="https://ozoneasylum.com/backlink?for=23426" title="Pages that link to Topic awaiting preservation: How do I download a file from Oracle with a click." rel="nofollow" >Topic awaiting preservation: How do I download a file from Oracle with a click.\

 
Author Thread
Pimms One
Bipolar (III) Inmate

From: Australia
Insane since: Jun 2003

posted posted 09-24-2004 10:01

I have used the uploadBean from http://www.javazoom.net/jzservlets/servlets.html to be able to upload files into Oracle database Long Raw column.

I am not sure how I could download it when user click on a link. I was thinking of an icon and when user click on the icon, there will be a prompt asking the user if they want to Save it or Open it.

Has anyone has example doing this in JSP?

Thank you.

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 09-24-2004 13:39

Since you are using JSP what you will need to do is in your response change the header to that of the file type. Then you will need to select the data using SQL and your connection to the database.

Then simply output the data. I am not up to date on my JSP syntax but your code would look something like

code:
<jsp:directive.page contentType="File/Type"/>
<%
String sql = "SELECT field FROM table WHERE id = givenId;

//Do the database query
//Put the data into a String called theFile

out.println(theFile);

%>



If the JSP directive option doesn't work then you might want to try
response.setContentType("File/Type");

Now finally depending upon your content type you might need to set up your main server to treat the files correctly.

« BackwardsOnwards »

Show Forum Drop Down Menu