Upload server + read value viarabe

S

sebek

Hello!
First, I`n new...:)
I want make upload file. I find some library: cos,
jakarta...fileupload, uploadbean.

I choose Jakarta. It`s a good choice?
Second. Code service should bo in: public void
doPost(HttpServletRequest
request, HttpServletResponse response) throws ServletException,
IOException? Maybe it`s stupid question butI have error:

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException: Invoker service() exception

org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:477)

org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream

org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)

org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)

org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)

org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
lectures.PageAdd.doGet(PageAdd.java:67)
lectures.PageAdd.doPost(PageAdd.java:121)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)

org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.15 logs.

A oto fragment kodu który jest umieszczony w metodzie doPost:
This is the code what I have in method doPost:

boolean isMultipart =
FileUpload.isMultipartContent(request);
DiskFileItemFactory factory = new
DiskFileItemFactory();
// Configure the factory here, if desired.
ServletFileUpload upload = new
ServletFileUpload(factory);
// Configure the uploader here, if desired.
List items = upload.parseRequest(request);

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();

if (item.isFormField()) {
//processFormField(item);
} else {
//processUploadedFile(item);
}
}

It`s take from Jakarta. (example)

And one, how can I read value varaible which is sending from form?

Great Thanks!
 
J

James Westby

sebek said:
Hello!
First, I`n new...:)
I want make upload file. I find some library: cos,
jakarta...fileupload, uploadbean. [snip]

java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream
[snip]

Do you have the jakarta commons IO jar in your WEB-INF/lib/ directory
(or wherever you have commons file upload)? It looks like it is needed.


James
 
Joined
May 10, 2006
Messages
1
Reaction score
0
I get this exception even after that

I have the required jar files under lib still get the same exception. Appreciate any thoughts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top