Home Answers Viewqa Java-Beginners upload and download all kinds of files in jsp

 
 


praveena
upload and download all kinds of files in jsp
2 Answer(s)      3 years and 2 months ago
Posted in : Java Beginners

how to upload and download all kinds of files ex: image file,pdf,.xls in jsp.

your help is highly appreciated.
View Answers

March 26, 2010 at 12:53 PM


we can upload the all type s of files into oracle 10g but when downloading we need mention the type of type(pdf..).....

March 27, 2010 at 11:24 AM


Hi Friend,

The code we have provided you for uploading will upload all kinds of file.Do modification in download.jsp:

<%@ page import="java.util.*,java.io.*"%>
<%@ page import="java.net.*"%>
<%!
public static String getMimeType(String fileUrl)
throws java.io.IOException, MalformedURLException
{
String type = null;
URL u = new URL(fileUrl);
URLConnection uc = null;
uc = u.openConnection();
type = uc.getContentType();
return type;
}

%>
<%
String file=request.getParameter("f");
File f = new File (file);
String filename=f.getName();
String type=getMimeType("file:"+file);

response.setContentType (type);
response.setHeader ("Content-Disposition", "attachment; filename=\""+filename+"\"");

String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();

int bit = 256;
int i = 0;
try {
while ((bit) >= 0) {
bit = in.read();
outs.write(bit);
}
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}
outs.flush();
outs.close();
in.close();
%>

Thanks









Related Pages:
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
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... link: http://www.roseindia.net/jsp/file_upload/uploadingMultipleFiles.shtml
upload and download files - JSP-Servlet
and download files in JSP visit to : http://www.roseindia.net/jsp/file_upload...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
Upload and Download in JSP - JSP-Servlet
Upload and Download in JSP  Respected Sir/Madam, I am... 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
JSP Upload and Downloading files - JSP-Servlet
JSP Upload and Downloading files  Respected Sir/Madam, Very... and downloading files in JSP, I am facing a problem.. 1) The file name is getting inserted... are fixed one for all types of files what I have uploaded.. I Dont know the exact
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   Here is an application that will upload the file and save
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
Mutliple files upload
Mutliple files upload  <%@page contentType="text/html...","Struts","Hibernet","Springs","JSP","Servlet","JavaScript"); listValue = new Array("CoreJava","J2EE","J2SE","Struts","Hibernet","Springs","JSP
Mutliple files upload
Mutliple files upload  <%@page contentType="text/html...","Struts","Hibernet","Springs","JSP","Servlet","JavaScript"); listValue = new Array("CoreJava","J2EE","J2SE","Struts","Hibernet","Springs","JSP
Mutliple files upload
Mutliple files upload  <%@page contentType="text/html...","Struts","Hibernet","Springs","JSP","Servlet","JavaScript"); listValue = new Array("CoreJava","J2EE","J2SE","Struts","Hibernet","Springs","JSP
Mutliple files upload
Mutliple files upload  <%@page contentType="text/html...","Struts","Hibernet","Springs","JSP","Servlet","JavaScript"); listValue = new Array("CoreJava","J2EE","J2SE","Struts","Hibernet","Springs","JSP
Mutliple files upload
Mutliple files upload   <%@page contentType="text/html...","Struts","Hibernet","Springs","JSP","Servlet","JavaScript"); listValue = new Array("CoreJava","J2EE","J2SE","Struts","Hibernet","Springs","JSP
how to upload and download images in java?
how to upload and download images in java?  what is the code for uploading and downloading images in java? how do I make a photo gallery through JSP....   Upload and Download images: 1)page.jsp: <%@ page language="java
java code to upload and download a file - Java Beginners
and Download visit to : http://www.roseindia.net/jsp/file_upload/index.shtml http...java code to upload and download a file  Is their any java code to upload a file and download a file from databse, My requirement is how can i
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 mp3
upload and download mp3   code of upload and download Mp3 file in mysql database using jsp and plz mention which data type used to store mp3 file in mysql database
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 file - JSP-Servlet
Upload and download file  What is JSP code to upload and download a document in a web page?  Hi Friend, Try the following code to upload the word document file: 1)page.jsp Display file upload form
Mutliple files upload
Mutliple files upload  Hi Sir, Am doing a project in Jsp and Servlets, i want to upload multiple files inside the grid of the table, and submit... the following link: http://www.roseindia.net/jsp/file_upload
upload and download video
upload and download video  how to upload and download video in mysql databse using jsp? plz give me demo of this with table...   1)page.jsp...;Display file upload form to the user</TITLE></HEAD> <BODY> <FORM
file upload download - Java Beginners
file upload download  how to upload and download files from one system to another using java.io.* and java.net.* only please send me code
Photo upload, Download
Photo upload, Download  Hi I am using NetBeans IDE for developing application for java(Swings). And i am using MySQL as backend database. My... this to the server machine so that this photo photo can be accessed in all of the machines
Uploading Multiple Files Using Jsp
to understand how you can upload multiple files by using the Jsp. We should avoid... Uploading Multiple Files Using Jsp  ... a file. In this example we are going to tell you how we can upload multiple files
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
upload and download a file - Java Beginners
upload and download a file  how to upload a file into project folder in eclipse and how to download the same using jsp   Hi Friend, Try the following code: 1)page.jsp: Display file upload form to the user
Different Kinds of Website
Different Kinds of Website... Markup Languages like HTML, XHTML. All publicly accessible web sites..., which is connected to all inner pages. Though most of the website
JSP file download - JSP-Servlet
all the files with a single button click... how to do this... Thanks...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
Uploading Multiple Files Using Jsp
to understand how you can upload multiple files by using the Jsp. We should avoid... below: Download all files... Uploading Multiple Files Using Jsp  
code to upload and download a file - Java Magazine
code to upload and download a file  Is their any code to upload a file and download a file from databse, My requirement is how can i store two different files with same path name but content different, ex,in mails, one
files uploding and downloading codes
files uploding and downloading codes  any one know JSP codes for upload files,download files and delete files from a created virtual memory
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
Uploading multiple files in JSP - JSP-Servlet
modification I need to do in the code to upload all the files attached. ...Uploading multiple files in JSP  Hi, I have this code in JSP for Uploading multiple files : Samples : Simple Upload
upload ,download and update file document - JDBC
upload ,download and update file document   hi sir.i am creating one application in jsp in which i need to upload the word document file which... to upload the word file: 1)page.jsp Display file upload form
How to upload file using JSP?
How to upload file using JSP?   Hi all, I m the beginner in JSP, I want to upload file on server in specific folder.   1)page.jsp... file upload form to the user</TITLE></HEAD> <
File Download in jsp
File Download in jsp  file upload code is working can u plz provide me file download
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
how to download a file from a folder??
how to download a file from a folder??  i can upload any kind of files to a folder, and only the path of the file is saved into the database, now how a client can download the file from my folder. pls provide me the jsp code
common database jsp file for all the jsp files in the application
common database jsp file for all the jsp files in the application  hi... use of this single jsp file while connecting to database rather than writing connectivity code in all the jsp pages . send me the code for that . thanks
To download a website from a given url. - JSP-Servlet
To download a website from a given url.  write a program to download a website from a given URL.it must download all the pages from that website.it should take the depth of retrieval from user input.all the files pages must
Multiple file upload - Struts
Multiple file upload  HI all, I m trying to upload multiple files using struts and jsp. I m using enctype="multipart". and the number of files need to upload is dynamically generated. I have tried using formfile. and also
Retrieving list of uploaded files.
download it. help me in the above coding plz... i can upload the file but cant...Retrieving list of uploaded files.  I need to retrieve list of files uploaded by all user's and display it on the webpage. Example: I uploaded 3
upload files to apache ftp server - Ajax
upload files to apache ftp server  hi,sir I want to upload multiple files to apache ftp server. I am using ajax framework for j2ee.Now I am okay for my customize code for my ftp testing.But I want to upload and download to ftp
upload video
upload video  hi sir i want to code of upload and download video in mysql database using jsp... and plz give advice which data type is used to store video in table
Upload Image to Database through Servlet - JSP-Servlet
Upload Image to Database through Servlet  Hello, I make a application from where I upload the Image from local disk then store in DB.Before storing.... classpath=C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar
FileUpload and Download
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... name as files and column name as file_data can you please correct it.. thanks
FileUpload and Download
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... name as files and column name as file_data can you please correct it.. thanks
FileUpload and Download
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... name as files and column name as file_data can you please correct it.. thanks
FileUpload and Download
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... name as files and column name as file_data can you please correct it.. thanks
FileUpload and Download
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... name as files and column name as file_data can you please correct it.. thanks
FileUpload and Download
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...;TITLE>Display file upload form to the user</TITLE></HEAD> <BODY>

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.