You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tim Oliver Wagner <li...@wagner-www.de> on 2006/01/24 11:54:29 UTC

fileupload

Hello,
I write a web application with JSPs (running at tomcat-server). My problem 
occours with uploadingfiles.

At the jsp-Page I defined this HTML-FORM (browser: Mozilla Firefox):

<h1>Hochladen einer Datei</h1>
	
<form action=<%= request.getRequestURL()%> method="post" 
ENCTYPE='multipart/form-data'>
	Datei: <input type="file" size="50" name="datei" maxlength="10000" 
accept="text/*"/><br/>
	<input type="submit" name="action" value="upload file" />
</form>

Now I try to parse the Multipart-Message:
if (FileUpload.isMultipartContent(request)) {
	try {
		// ENCTYPE='multipart/form-data' Daten rauslesen!!!
		FileItemFactory factory = new DiskFileItemFactory();
		ServletFileUpload upl = new ServletFileUpload(factory);
		java.util.List items = upl.parseRequest(request);
		.........

At the last line (java.util.List items ....) the error accurs. But I dont 
understand why ...

I hope someone can help me.

tia

Oli

PS:
I think I did everything in that way like at 
http://jakarta.apache.org/commons/fileupload/using.html descibed.

Re: fileupload

Posted by Tim Oliver Wagner <li...@wagner-www.de>.
I don't think that I use struts. I just wan't a simple fileupload. (later I 
want to write this file in an DB ). But first I have to solve the Problem to 
upload the file to the Server and parse the request-Object ... later I try to 
put the Data to the DB ...

The other message I answert with my complete source from JSP ... additional 
the error-Message from the tomcat ...

greets, oli

Am Dienstag 24 Januar 2006 16:17 schrieb Dakota Jack:
> Are you using something like Struts, which grabs the request from you with
> multiparts?  Try seeing if you have the request.
>
> On 1/24/06, Tim Oliver Wagner <li...@wagner-www.de> wrote:
> > Hello,
> > I write a web application with JSPs (running at tomcat-server). My
> > problem occours with uploadingfiles.
> >
> > At the jsp-Page I defined this HTML-FORM (browser: Mozilla Firefox):
> >
> > <h1>Hochladen einer Datei</h1>
> >
> > <form action=<%= request.getRequestURL()%> method="post"
> > ENCTYPE='multipart/form-data'>
> >         Datei: <input type="file" size="50" name="datei"
> > maxlength="10000" accept="text/*"/><br/>
> >         <input type="submit" name="action" value="upload file" />
> > </form>
> >
> > Now I try to parse the Multipart-Message:
> > if (FileUpload.isMultipartContent(request)) {
> >         try {
> >                 // ENCTYPE='multipart/form-data' Daten rauslesen!!!
> >                 FileItemFactory factory = new DiskFileItemFactory();
> >                 ServletFileUpload upl = new ServletFileUpload(factory);
> >                 java.util.List items = upl.parseRequest(request);
> >                 .........
> >
> > At the last line (java.util.List items ....) the error accurs. But I dont
> > understand why ...
> >
> > I hope someone can help me.
> >
> > tia
> >
> > Oli
> >
> > PS:
> > I think I did everything in that way like at
> > http://jakarta.apache.org/commons/fileupload/using.html descibed.
>
> --
> "You can lead a horse to water but you cannot make it float on its back."
> ~Dakota Jack~

Re: fileupload

Posted by Dakota Jack <da...@gmail.com>.
Are you using something like Struts, which grabs the request from you with
multiparts?  Try seeing if you have the request.

On 1/24/06, Tim Oliver Wagner <li...@wagner-www.de> wrote:
>
> Hello,
> I write a web application with JSPs (running at tomcat-server). My problem
> occours with uploadingfiles.
>
> At the jsp-Page I defined this HTML-FORM (browser: Mozilla Firefox):
>
> <h1>Hochladen einer Datei</h1>
>
> <form action=<%= request.getRequestURL()%> method="post"
> ENCTYPE='multipart/form-data'>
>         Datei: <input type="file" size="50" name="datei" maxlength="10000"
> accept="text/*"/><br/>
>         <input type="submit" name="action" value="upload file" />
> </form>
>
> Now I try to parse the Multipart-Message:
> if (FileUpload.isMultipartContent(request)) {
>         try {
>                 // ENCTYPE='multipart/form-data' Daten rauslesen!!!
>                 FileItemFactory factory = new DiskFileItemFactory();
>                 ServletFileUpload upl = new ServletFileUpload(factory);
>                 java.util.List items = upl.parseRequest(request);
>                 .........
>
> At the last line (java.util.List items ....) the error accurs. But I dont
> understand why ...
>
> I hope someone can help me.
>
> tia
>
> Oli
>
> PS:
> I think I did everything in that way like at
> http://jakarta.apache.org/commons/fileupload/using.html descibed.
>
>
>


--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~