cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trueb...@sachsendv.de
Subject Re: MultiPart upload action
Date Mon, 20 Oct 2008 09:35:14 GMT
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 <j.hoechstaedter@memocomp.de>
To:
users@cocoon.apache.org
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/users@cocoon.apache.org/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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org






_________________________________________________________________

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
Mime
View raw message