aspose file tools*
The moose likes JSP and the fly likes file download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "file download" Watch "file download" New topic
Author

file download

Indrayani Bhoir
Greenhorn

Joined: Dec 02, 2002
Posts: 21
Hi ,
i want to know that is there any way to provide file download option using jsp .
currently i am using follwing code for file download option but as this don't allow any java
script to be used in same page. i am facing some problem.
<%
// fetch the file
String filename = "companySecret.txt";
String filepath = "C:\\";
response.setContentType(
"APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition",
"attachment; filename=\""
+ filename + "\"");
java.io.FileInputStream fileInputStream =
new java.io.FileInputStream(filepath
+ filename);
int i;
while ((i=fileInputStream.read()) != -1) {
out.write(i);
}
fileInputStream.close();
out.close();
%>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file download
 
Similar Threads
File Downloading in IE6
Splitting a zip file and rejoining it
How to display pdf file in broswer
Unable to upload file
Trying to use JSP to force file download..