> http://commons.apache.org/fileupload/
>
> Arne
thanks for suggesting but i think i'll need more help
as it hasn't worked out yet
i tried the following code to upload files
to tomcat (web server)
upload1.jsp---->
__________________________________________________________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upload 1</title>
</head>
<body>
<form action="http://localhost:8080/CloudscapeDemo/upload2.jsp"
method="post"
enctype="multipart/form-data">
<input type="file" name="docfile1" />
<input type="file" name="docfile2" />
<input type="file" name="docfile3" />
<input type="submit" value="Upload" />
</form>
</body>
</html>
____________________________
and the jsp for handling the uploaded data upload2.jsp is ---->
________________________________________________
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%@ page import="org.apache.commons.fileupload.disk.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upload 2</title>
</head>
<body>
<%
String docfilename = "";
long docsize = 0;
String contentsdf = "";
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload fu = new ServletFileUpload(factory);
List fileItems = fu.parseRequest(request);
out.println("TOTALFILES:" + fileItems.size() + "<br>");
Iterator itr = fileItems.iterator();
fu.setSizeMax(1000000); // throw exception if > 1 Mb
while (itr.hasNext()) {
FileItem fi = (FileItem) itr.next();
if (!fi.isFormField()) {
// only process files here, not form fields
docfilename = fi.getName();
docsize = fi.getSize();
contentsdf = fi.getString();
}
if (docsize > 0) {
out.println("FILENAME:" + docfilename + "<br>");
out.println("FILESIZE:" + docsize + "<br>");
out.println("FILECONTENT:" + contentsdf + "<br>");
}
}
%>
</body>
</html>
____________________________________________
on pressing the submit button tomcat shows following errors:-----
_________________________________
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException:
java.lang.NoClassDefFoundError: org/apache/commons/io/output/
DeferredFileOutputStream
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:
541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/
apache/commons/io/output/DeferredFileOutputStream
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:
850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:
779)
org.apache.jsp.CloudscapeDemo.upload2_jsp._jspService(upload2_jsp.java:
107)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:
70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
____________________________________________
i cannot figure out whether there is a problem with this code
or with my tomcat installation.
kindly help
Arne Vajhøj - 13 Oct 2007 03:17 GMT
>> http://commons.apache.org/fileupload/
> org.apache.jasper.JasperException: javax.servlet.ServletException:
> java.lang.NoClassDefFoundError: org/apache/commons/io/output/
> DeferredFileOutputStream
You are missing one of the Jakarta jar files in WEB-INF/lib.
Arne
K Gaur - 13 Oct 2007 03:28 GMT
> You are missing one of the Jakarta jar files in WEB-INF/lib.
i have tried copying all jar files in .../tomcat6.0/lib to my web
application's WEB-INF/lib folder
but in vain
the server still shows same error
how do i tackle this?
i m watching this space
please help
Lew - 13 Oct 2007 03:38 GMT
>> You are missing one of the Jakarta jar files in WEB-INF/lib.
>
[quoted text clipped - 6 lines]
>
> i m watching this space
Go to the Apache commons.fileupload page and carefully read their installation
and usage instructions.

Signature
Lew
Arne Vajhøj - 13 Oct 2007 04:11 GMT
>> You are missing one of the Jakarta jar files in WEB-INF/lib.
>
> i have tried copying all jar files in .../tomcat6.0/lib to my web
> application's WEB-INF/lib folder
> but in vain
> the server still shows same error
Ofcourse - those file were already in the classpath.
You need the jar files needed by FileUpload.
Arne