• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

download help

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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){
}
%>
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic