This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes uploading a file using jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "uploading a file using jsp" Watch "uploading a file using jsp" New topic
Author

uploading a file using jsp

vidula kulkarni
Greenhorn

Joined: May 24, 2001
Posts: 18
hi,
how can i upload a file in jsp?is there a way to call a servlet from a jsp.
thanks
Asif Anis
Greenhorn

Joined: Mar 02, 2001
Posts: 19
where do u want to upload the file? if u r uploading a file in the datdabase then which database because i've recently uploaded files in datdbase oracle 8i , and i used the blob data type for that
SRINI VASAN
Ranch Hand

Joined: Aug 29, 2000
Posts: 48
Hi,
U can do that by using Multipart. Please browse through URLhttp://www.jspsmart.com/liblocal/docs/en/articles/upload_en.htm for details. Mail me if have any more doubts.
regards,
srini


You can contact me in srinivas_an@yahoo.com
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
dear
better use jspSmatUpload
search fr it on google...
good luck


Malhar Barai
SOA & Java Book
sea yin
Greenhorn

Joined: Sep 09, 2001
Posts: 5
<%@ page language="java" import="com.jspsmart.upload.*"%> <jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /> <HTML> <BODY BGCOLOR="white"> <H1>jspSmartUpload : Sample 2</H1> <HR> <% // Variables int count=0; // Initialization mySmartUpload.initialize(pageContext); // Upload mySmartUpload.upload(); // Select each file for (int i=0;i<mySmartUpload.getFiles().getCount();i++){ // Retreive the current file com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i); // Save it only if this file exists if (!myFile.isMissing()) { // Save the files with its original names in a virtual path of the web server myFile.saveAs("/upload/" + myFile.getFileName()); // myFile.saveAs("/upload/" + myFile.getFileName(), mySmartUpload.SAVE_VIRTUAL); // sample with a physical path // myFile.saveAs("c:\\temp\\" + myFile.getFileName(), mySmartUpload.SAVE_PHYSICAL); // Display the properties of the current file out.println("FieldName = " + myFile.getFieldName() + "<BR>"); out.println("Size = " + myFile.getSize() + "<BR>"); out.println("FileName = " + myFile.getFileName() + "<BR>"); out.println("FileExt = " + myFile.getFileExt() + "<BR>"); out.println("FilePathName = " + myFile.getFilePathName() + "<BR>"); out.println("ContentType = " + myFile.getContentType() + "<BR>"); out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>"); out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>"); out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>"); count ++; } } // Display the number of files which could be uploaded out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>"); // Display the number of files uploaded out.println(count + " file(s) uploaded."); %> </BODY> </HTML>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: uploading a file using jsp