This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

download help

 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!!! i have a jsp page where in that page i made a hyperlink. if the user click the hyperlink, they will get a pop-up a windows ask whether user want to open or save the file. the file actually stored in server. all the idea behind this is to give the user the ability to open or save a file that been stored in server.do anybody have an idea on this
[ December 01, 2004: Message edited by: Bear Bibeault ]
 
Santosh Maskar
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Suka Hati:
hi!!! i have a jsp page where in that page i made a hyperlink. if the user click the hyperlink, they will get a pop-up a windows ask whether user want to open or save the file. the file actually stored in server. all the idea behind this is to give the user the ability to open or save a file that been stored in server.do anybody have an idea on this


hey, this will happen when you have associated exstention configured in window (not sure abt the unix) , say if u dont have the download file format u need to add this file format in windows


so then it automatically ask to open or save the file with known extention

try to download the .txt file and see the result

then try to download .java file then see the result.

will help you .....

 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i try to use below code but when it generate the downloaded file...the file corrupted....i dont know what couse this error



<%@ page language="java" import="java.io.*"%>
<%
String filePath;
//
//String filePath="C:\\Program Files\\Apache Group\\jakarta-tomcat-4.1.29\\bin\\temp.wav";
String fileNameNew="temp.wav";
filePath="/bin/"+fileNameNew;
response.setContentType("audio/wav");

response.addHeader("Content-Disposition", "attachment; filename="+fileNameNew);
try{
File uFile= new File("C:/Program Files/Apache Group/jakarta-tomcat-4.1.29/bin/temp.wav");
int fSize=(int)uFile.length();
FileInputStream fis = new FileInputStream(uFile);
PrintWriter pw = response.getWriter();
int c=-1;
// Loop to read and write bytes.
//pw.print("Test");

while ((c = fis.read()) != -1){
pw.print((char)c);
}
// Close output and input resources.
fis.close();
pw.flush();
pw=null;
}catch(Exception e){
}
%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic