Hi guys,

thank you all for your replies.

The MultipartFilter was already added. I am using Cocoon 2.2 and Tomcat 5.5. I tried to enable file uploads, too, for example but others say and it seems to be the case, that this is already done in Cocoon 2.2.

I found out, that the class-cast Execption disappears when I remove the sourrounding form-tag. Second I have to call the pipeline directly (not by an internal redirect). I would be happy if other things would help, but it for me it does not seem so at the moment.

cheers,
Johannes

[EMAIL PROTECTED] schrieb:

Using tomcat 5.5 I needed to add the MultipartFilter to my web.xml.
Maybe this works for you too.

    <filter>
<description>Multipart MIME handling filter for Cocoon</description>
      <display-name>Cocoon multipart filter</display-name>
      <filter-name>CocoonMultipartFilter</filter-name>
<filter-class>org.apache.cocoon.servlet.multipart.MultipartFilter</filter-class>
    </filter>

Tobias


From:   Johannes Hoechstaedter <[EMAIL PROTECTED]>
To:     [email protected]
Date:   17.10.2008 16:38
Subject:        MultiPart upload action


------------------------------------------------------------------------



Hi, everybody,

I want to upload a file into my database. I want to upload it by my own
action. I followed several examples for file uploads in cocoon for
example: http://wiki.apache.org/cocoon/FileUploadWithAction and followed
this thread
http://www.mail-archive.com/[email protected]/msg41160.html .

My code in the act method of my action look as follows:

Request  request = (Request)ObjectModelHelper.getRequest(objectModel);
System.out.println(request.get("picture"));
Part filePart = (Part) request.get("picture");

I get a class cast exception in the third line:
"java.lang.ClassCastException: java.lang.String".
request.get("picture"); returns a String. How can I get a Part object?
The filename is printed out correctly in line 2.

This is my html:

<html>
....
<form method="get" action="someaction">
.....

<form enctype="multipart/form-data" method="post" action="/webapp-1.0/switch/severalparameters"> <input type="file" name="picture"><input class="button" value="Upload" name="submit" type="submit">
</form>
....

</form>
....
</html>

I would be happy if anyone can help.

cheers
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





_________________________________________________________________

Sachsen DV Betriebs- und Servicegesellschaft mbH
Täubchenweg 26
04317 Leipzig
Amtsgericht Leipzig, HRB 18545

Geschäftsführer: Herbert Roller Brandão, Dr. Jean-Michael Pfitzner

Aufsichtsratsvorsitzender: Andreas Benninger

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to