cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Hoechstaedter <j.hoechstaed...@memocomp.de>
Subject MultiPart upload action
Date Fri, 17 Oct 2008 14:39:46 GMT
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


Mime
View raw message