Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Download Button
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Pradeep.C.R
Download Button
1 Answer(s)      5 years and 8 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

March 18, 2009 at 4:50 AM


Hi Pradeep

Can you try this

try {
response.reset();
response.setContentType("APPLICATION/OCTET-STREAM/GIF/XML");
if (request.getParameter("fileName") != null) {
out.println(request.getParameter("fileName"));
String str= request.getParameter("fileName");
byte[] bytes = Repository.getFile(str); // thi function(personal) gives me direct byte array of file
str=str.substring(0,str.indexOf("~"));
Integer fileLength = Integer.decode(String.valueOf(bytes.length));
response.setContentLength(fileLength.intValue());
response.setHeader("Content-Disposition","attachment; filename=\""str"\"");
response.getOutputStream().write(bytes);
response.getOutputStream().flush();
response.getOutputStream().close();
response.sendRedirect("FileInfo.jsp");
}
} catch (Exception e) {
e.printStackTrace();
}



This is just an idea how you can fir in your code

Regards
Ranjan


Related Tutorials/Questions & Answers:
Download Button - JSP-Servlet
. And i want the Bank customers to DOWNLOAD the mini statement. Can any one help me how to implement the download button so that on clicking that the mini...Download Button  HI friends, This is my maiden question
Download
Download JDK  How to Download the latest Version of JDK?   Download OST to PST converter from: http://www.osttopst.info
Advertisements
Download.
Download.  I need a swing program to download a file from the server
download
download  how to download the file in server using php code: "<form method="post" action=""> enter the folder name<input type="text" name="t1" > <input type="submit" value="search" name="s1"> </form> <
Button
Button  How to use image for button in JSF
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can we retriving dat from database, capturing data, moving to next page.. etc
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can be retriving dat from database, capturing data, moving to next page.. etc
download excel
download excel  hi i create an excel file but i don't i know how to give download link to that excel file please give me any code or steps to give download link
Java download
Java download  Hi, Is it possible to download the Java for Linux Centos 6? From where it can be downloaded for Linux Centos 6? Thanks
file download
file download  I uploaded a file and saved the path in database. Now i want to download it can u plz provide code
Download Java
process of downloading and Installing Java  Hi, How easy is the process of downloading and Installing Java? I have windows 7 machines. Can anyone tell me how to download and install Java? Thanks
download - SQL
download  i want download the mysql server  Hi friend, The latest version of MySQL can be downloaded from http://www.mysql.com. Read for more information. http://www.roseindia.net/mysql/mysql5/Installing
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello sir/madam, I need a simple code for File upload and Download in jsp using sql server,that uploaded file should... be download with its full content...can you please help me... im in urgent i have
Download LINK - JSP-Servlet
Download LINK  sorry i am the new1 to java. I am learning and doing the project, can you please send me the complete code. So that i can understand easily. i want the code like by Clicking DOWNLOAD button the SAVE as dialog box
csv file download
csv file download  Hello Every one, when user clicks download button I want to retrieve data from mysql database table in csv format using java.if you know please send code. Thanks in Advance   Please visit
how to download oracle 9i
how to download oracle 9i  how to download oracle 9i
download code from database
download code from database  how to download files from database
Download PDF file
Download PDF file  How to download PDF file with JSF
php download file script
php download file script  PHP script to download file in IE
php download free
php download free  From where i download php free
wnidows button
wnidows button   How to handle windows back and forward button in struts applications, without using java script
radio button
radio button  On selecting a radio button, it should open a aspx page
Style in button
Style in button  Hi.... How can I set the button width with fx:style... of the button will not set by the style because it is the property of the button not the style property of the button. Thanks
html button
html button  when i click the submit button the entered data will be displayed below the submit button please help me
Free download java
Free download java  Hi, Where can I download java for absolutely free and quickly? Thanks
File Download in jsp
File Download in jsp  file upload code is working can u plz provide me file download
Advertisements
 

 

 

DMCA.com