Re:number of Files download problem in jsp

Ads

 
 
 

Share on Google+Share on Google+

pradeep
Re:number of Files download problem in jsp
0 Answer(s)      6 years and 8 months ago
Posted in : JSP-Servlet
I write code for single file downloading , but I want to download number of files at same time , means I want stored number of files in one temp zip file then it download it. please help in this case ...
code :

<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.BufferedInputStream" %>
<%@ page import="java.io.File " %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.*" %>

<%
String dwFilename ="C:\\downloadJSP\\raj.zip";
response.addHeader("Content-Disposition","attachment; filename="+dwFilename );
// set the http content type to "APPLICATION/OCTET-STREAM
response.setContentType("APPLICATION/OCTET-STREAM");

// initialize the http content-disposition header to
// indicate a file attachment with the default filename
BufferedInputStream buf=null;
ServletOutputStream myOut=null;
try {
myOut = response.getOutputStream();
File myfile = new File(dwFilename);

// set response headers
response.setContentType("text/plain");

response.addHeader("Content-Disposition","attachment; filename="+dwFilename );

response.setContentLength( (int) myfile.length( ) );

FileInputStream input = new FileInputStream(myfile);
buf = new BufferedInputStream(input);
int readBytes = 0;

//read from the file; write to the ServletOutputStream
while((readBytes = buf.read( )) != -1)
myOut.write(readBytes);

} catch (IOException ioe){

throw new ServletException(ioe.getMessage( ));

} finally {

//close the input/output streams
if (myOut != null)
myOut.close( );
if (buf != null)
buf.close( );


}
%>

<p>Files: <%=dwFilename%></p>
Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Re:number of Files download problem in jsp - JSP-Servlet
Re:number of Files download problem in jsp  I write code for single file downloading , but I want to download number of files at same time , means I want stored number of files in one temp zip file then it download it. please
Upload and Download Large files in jsp
Upload and Download Large files in jsp  I am not able to download large files (>200mb) from any server. I need a code to download and upload large files (atleast 4 gb) to a server using jsp page
Advertisements
upload and download files - JSP-Servlet
upload and download files  HI!! how can I upload (more than 1 file) and download the files using jsp. Is any lib folders to be pasted? kindly... and download files in JSP visit to : http://www.roseindia.net/jsp/file_upload
how to download the uploaded folder files using jsp
how to download the uploaded folder files using jsp  how to download the uploaded folder files using jsp
Problem in downloading files - JSP-Servlet
Problem in downloading files  Hi, i have uploaded some files using its uploading successfully. but when downloading the same file, its giving...:148) at org.apache.jsp.downloadfile_jsp._jspService(downloadfile_jsp.java:146
download pdf files
download pdf files  pls help me,I don't know how to convert .doc,.docx files into pdf files and download that pdf files using servlet or jsp
upload and download all kinds of files in jsp - Java Beginners
upload and download all kinds of files in jsp  how to upload and download all kinds of files ex: image file,pdf,.xls in jsp. your help is highly appreciated.  we can upload the all type s of files into oracle 10g
Creat a folder, inside it upload and download files in jsp and mysql
Creat a folder, inside it upload and download files in jsp and mysql  Create one or more folder .inside it we can upload and download multiple files... to database. The uploaded files will then displayed on the browser and will allow the user
Upload and Download multiple files
Upload and Download multiple files  Hello Sir/Madam, I need a simple code for upload and download multiple files(it may be image,doc... using jsp with sqlserver ,can you please provide a proper coding for it and also
How to download files from server to local disk using ZIP format in JSP page - JSP-Servlet
How to download files from server to local disk using ZIP format in JSP page  hi i have an application to upload and download multiple files. As i can upload multiple files .now i have to download all uploaded files on local
Upload and Download in JSP - JSP-Servlet
and downloading a file in JSP.. When the admin clicks upload, he must be able to upload files and similarly when the user clicks the download option, he must be able...Upload and Download in JSP  Respected Sir/Madam, I am
download or save jsp page
download or save jsp page  hii.., this is my jsp page .. This page is theater ticket. i want to download this page. so i need to save this page or download.. that depend on user wish how to make this page save or download <
download or save jsp page
download or save jsp page  hii.., this is my jsp page .. This page is theater ticket. i want to download this page. so i need to save this page or download.. that depend on user wish how to make this page save or download <
setting path problem for org.jfree files - Java Beginners
have those classes which you have import. Download the following jar files...setting path problem for org.jfree files  Hi deepak, As u said, i have downloaded two files jar files and placed them in lib folder to work
JSP file download - JSP-Servlet
JSP file download  Hi! I am saving (webapp/docs/sample.docx) path of the word file in database. when i want to download that file i am eliminating... on the link it is asking open or save. Upto this is fine..... I want to download
File Download in jsp
File Download in jsp  file upload code is working can u plz provide me file download
Download file - JSP-Servlet
Servlet download file from server  I am looking for a Servlet download file example
Download dynamic link files to local directory - java code
Download dynamic link files to local directory - java code  Hi, I found a code that downloads static links but not dynamic link files.can anyone give a solution for downloading dynamic link files? Thanks in advance
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
download - JSP-Servlet
download  here is the code in servlet for download a file. while...; /** * * @author saravana */ public class download extends HttpServlet...(); System.out.println("inside download servlet"); BufferedInputStream
Download Button - JSP-Servlet
Download Button  HI friends, This is my maiden question.... 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
upload and download files from ftp server using servlet - Ajax
upload and download files from ftp server using servlet  Hi,Sir Sorry for my complex questions. My problem is that I don't know client side script for upload and download files from ftp server using servlet and how to use
java/jsp code to download a video
java/jsp code to download a video  how can i download a video using jsp/servlet
File Upload And download JSP Urgent - JSP-Servlet
File Upload And download JSP Urgent  Respected Sir/Madam, I... Download in JSP.. In the Admin window, There must be "Upload" provision where admin can upload files.. And in the user window, There must be a "Download" provision
download image using url in jsp
download image using url in jsp  how to download image using url in jsp
org.jfree package download - JSP-Servlet
org.jfree package download  I saw a code in roseindia but that code requires a package "org.jfree.chart.*" and "org.jfree.ui.*" Please give me the packages .  Hi friend, Plz download the jar files
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Jsp problem
Jsp problem  Hello friends.I want to share my jsp problem.I want to show all of my database(mysql) tables except two(user,manufacturer) in a jsp page.plssss help me
jsp problem
jsp problem  problem:::::::: On JSP form ,when i insert data in text field........at that time action is perform and data is retriev from data base and get assign to other field on that form........ when data is assign to other
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads